上传战斗翻译

This commit is contained in:
liwei1dao 2022-09-26 20:25:20 +08:00
parent 45fea5cf76
commit b586682d1d
20 changed files with 798 additions and 32 deletions

2
go.mod
View File

@ -187,7 +187,7 @@ require (
gopkg.in/ini.v1 v1.66.6 // indirect gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1
honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect
) )

View File

@ -44,12 +44,95 @@ func (this *AttributeNumeric) Value() float32 {
return this.fixedValue.Scalar() return this.fixedValue.Scalar()
} }
///基础数值
func (this *AttributeNumeric) SetBase(value float32) float32 { func (this *AttributeNumeric) SetBase(value float32) float32 {
this.BaseValue.SetFloat(value) this.BaseValue.SetFloat(value)
this.onChange() this.onChange()
return this.BaseValue.Value() return this.BaseValue.Value()
} }
func (this *AttributeNumeric) onChange() { func (this *AttributeNumeric) AddBase(value float32) float32 {
// this.fixedValue = (this.BaseValue.Fixed()*(1+this.ProValue.Fixed())+this.AppendValue.Fixed())*(1+this.BuffProValue.Fixed()) + this.BuffValue.Fixed() this.BaseValue.Add(value)
this.onChange()
return this.BaseValue.Value()
}
func (this *AttributeNumeric) MinusBase(value float32) float32 {
this.BaseValue.Minus(value)
this.onChange()
return this.BaseValue.Value()
}
///附加数值
func (this *AttributeNumeric) SetAppend(value float32) float32 {
this.AppendValue.SetFloat(value)
this.onChange()
return this.AppendValue.Value()
}
func (this *AttributeNumeric) AddAppend(value float32) float32 {
this.AppendValue.Add(value)
this.onChange()
return this.AppendValue.Value()
}
func (this *AttributeNumeric) MinusAppend(value float32) float32 {
this.AppendValue.Minus(value)
this.onChange()
return this.AppendValue.Value()
}
///附加百分比数值
func (this *AttributeNumeric) SetPro(value float32) float32 {
this.ProValue.SetFloat(value)
this.onChange()
return this.ProValue.Value()
}
func (this *AttributeNumeric) AddPro(value float32) float32 {
this.ProValue.Add(value)
this.onChange()
return this.ProValue.Value()
}
func (this *AttributeNumeric) MinusPro(value float32) float32 {
this.ProValue.Minus(value)
this.onChange()
return this.ProValue.Value()
}
/// Buff附加数值
func (this *AttributeNumeric) SetBuff(value float32) float32 {
this.BuffValue.SetFloat(value)
this.onChange()
return this.BuffValue.Value()
}
func (this *AttributeNumeric) AddBuff(value float32) float32 {
this.BuffValue.Add(value)
this.onChange()
return this.BuffValue.Value()
}
func (this *AttributeNumeric) MinusBuff(value float32) float32 {
this.BuffValue.Minus(value)
this.onChange()
return this.BuffValue.Value()
}
/// Buff附加百分比数值
func (this *AttributeNumeric) SetBuffPro(value float32) float32 {
this.BuffProValue.SetFloat(value)
this.onChange()
return this.BuffProValue.Value()
}
func (this *AttributeNumeric) AddBuffPro(value float32) float32 {
this.BuffProValue.Add(value)
this.onChange()
return this.BuffProValue.Value()
}
func (this *AttributeNumeric) MinusBuffPro(value float32) float32 {
this.BuffProValue.Minus(value)
this.onChange()
return this.BuffProValue.Value()
}
func (this *AttributeNumeric) onChange() {
this.fixedValue = (FixedPoint_Multiply(this.BaseValue.Fixed(), (NewFixedPoint(1)+this.ProValue.Fixed())) + FixedPoint_Multiply(this.AppendValue.Fixed(), (NewFixedPoint(1)+this.BuffProValue.Fixed())) + this.BuffValue.Fixed())
} }

View File

@ -29,6 +29,7 @@ func (this FixedNumeric) SetFloat(value float32) float32 {
this.baseValue = NewFixedPoint(value) this.baseValue = NewFixedPoint(value)
return this.baseValue.Scalar() return this.baseValue.Scalar()
} }
func (this FixedNumeric) Set(value FixedPoint) float32 { func (this FixedNumeric) Set(value FixedPoint) float32 {
this.baseValue = value this.baseValue = value
return this.baseValue.Scalar() return this.baseValue.Scalar()

View File

@ -9,25 +9,21 @@ import (
const CARDINAL_NUMBER int = 10000 const CARDINAL_NUMBER int = 10000
func NewFixedPoint(value float32) FixedPoint { func NewFixedPoint(value float32) FixedPoint {
return FixedPoint{ return FixedPoint(math.Round(float64(value * float32(CARDINAL_NUMBER))))
rawValue: int(math.Round(float64(value * float32(CARDINAL_NUMBER)))),
}
} }
type FixedPoint struct { type FixedPoint int
rawValue int
}
func (this FixedPoint) SetInt(v int) { func (this FixedPoint) SetInt(v int) {
this.rawValue = v this = FixedPoint(v)
} }
func (this FixedPoint) Scalar() float32 { func (this FixedPoint) Scalar() float32 {
return float32(this.rawValue) * 0.0001 return float32(this) * 0.0001
} }
func (this FixedPoint) ToInt() int { func (this FixedPoint) ToInt() int {
return this.rawValue / CARDINAL_NUMBER return int(this) / CARDINAL_NUMBER
} }
func (this FixedPoint) ToFloat() float32 { func (this FixedPoint) ToFloat() float32 {
return this.Scalar() return this.Scalar()
@ -39,39 +35,31 @@ func (this FixedPoint) ToString() string {
/// - /// -
func (this FixedPoint) Add(v float32) { func (this FixedPoint) Add(v float32) {
y := NewFixedPoint(v) y := NewFixedPoint(v)
this.rawValue = this.rawValue + y.rawValue this = FixedPoint(int(this) + int(y))
} }
/// - /// -
func (this FixedPoint) Reduce(v float32) { func (this FixedPoint) Reduce(v float32) {
y := NewFixedPoint(v) y := NewFixedPoint(v)
this.rawValue = this.rawValue - y.rawValue this = FixedPoint(int(this) - int(y))
} }
/// + /// +
func FixedPoint_Add(x, y FixedPoint) FixedPoint { func FixedPoint_Add(x, y FixedPoint) FixedPoint {
result := FixedPoint{} return FixedPoint(x + y)
result.rawValue = x.rawValue + y.rawValue
return result
} }
/// - /// -
func FixedPoint_Reduce(x, y FixedPoint) FixedPoint { func FixedPoint_Reduce(x, y FixedPoint) FixedPoint {
result := FixedPoint{} return FixedPoint(x - y)
result.rawValue = x.rawValue - y.rawValue
return result
} }
/// * /// *
func FixedPoint_Multiply(x, y FixedPoint) FixedPoint { func FixedPoint_Multiply(x, y FixedPoint) FixedPoint {
result := FixedPoint{} return FixedPoint((int(x) * int(y)) / CARDINAL_NUMBER)
result.rawValue = (x.rawValue * y.rawValue) / CARDINAL_NUMBER
return result
} }
/// / /// /
func FixedPoint_Divide(x, y FixedPoint) FixedPoint { func FixedPoint_Divide(x, y FixedPoint) FixedPoint {
result := FixedPoint{} return FixedPoint((int(x) * CARDINAL_NUMBER) / int(y))
result.rawValue = (x.rawValue * CARDINAL_NUMBER) / (y.rawValue)
return result
} }

View File

@ -49,6 +49,18 @@ func (this *HealthPoint) MaxValue() int32 {
return int32(this.CurrMaxHp.Value()) return int32(this.CurrMaxHp.Value())
} }
func (this *HealthPoint) OnChange() {
//先计算当前血量百分比
var per = this.Percent()
// 当前最大生命值 = 总生命 * 1 + 当前最大生命百分比加成 + 当前最大生命加成
//FightDebug.Log($"增加前属性{(MaxHp.Fixed)}----- {(1 + CurrMaxHpPro.Fixed)}----- {CurrMaxHpAppend.Fixed}");
this.CurrMaxHp.SetBase((FixedPoint_Multiply(this.MaxHp.Fixed(), (NewFixedPoint(1)+this.CurrMaxHpPro.Fixed())) + this.CurrMaxHpAppend.Fixed()).Scalar())
//计算变化之后的当前血量
var curHp = FixedPoint_Multiply(this.CurrMaxHp.Fixed(), NewFixedPoint(per))
this.Hp.Set(curHp)
//FightDebug.Log($"增加后属性{(MaxHp.Fixed)}----- {(1 + CurrMaxHpPro.Fixed)}----- {CurrMaxHpAppend.Fixed}");
}
/// <summary> /// <summary>
/// 扣血 /// 扣血
/// </summary> /// </summary>
@ -61,7 +73,7 @@ func (this *HealthPoint) Minus(value float32) {
/// 加血 /// 加血
/// </summary> /// </summary>
func (this *HealthPoint) Add(value float32) { func (this *HealthPoint) Add(value float32) {
if FixedPoint_Add(this.Hp.Fixed(), NewFixedPoint(value)).rawValue > this.CurrMaxHp.Fixed().rawValue { if FixedPoint_Add(this.Hp.Fixed(), NewFixedPoint(value)) > this.CurrMaxHp.Fixed() {
this.Reset() this.Reset()
} else { } else {
this.Hp.Add(value) this.Hp.Add(value)
@ -72,7 +84,7 @@ func (this *HealthPoint) Add(value float32) {
/// 获取治疗溢出值 /// 获取治疗溢出值
/// </summary> /// </summary>
func (this *HealthPoint) Overflow(value float32) float32 { func (this *HealthPoint) Overflow(value float32) float32 {
if FixedPoint_Add(this.Hp.Fixed(), NewFixedPoint(value)).rawValue > this.CurrMaxHp.Fixed().rawValue { if FixedPoint_Add(this.Hp.Fixed(), NewFixedPoint(value)) > this.CurrMaxHp.Fixed() {
return FixedPoint_Divide(FixedPoint_Add(this.Hp.Fixed(), NewFixedPoint(value)), this.CurrMaxHp.Fixed()).Scalar() return FixedPoint_Divide(FixedPoint_Add(this.Hp.Fixed(), NewFixedPoint(value)), this.CurrMaxHp.Fixed()).Scalar()
} }
return 0 return 0
@ -84,3 +96,31 @@ func (this *HealthPoint) Overflow(value float32) float32 {
func (this *HealthPoint) Percent() float32 { func (this *HealthPoint) Percent() float32 {
return FixedPoint_Divide(this.Hp.Fixed(), this.CurrMaxHp.Fixed()).Scalar() return FixedPoint_Divide(this.Hp.Fixed(), this.CurrMaxHp.Fixed()).Scalar()
} }
/// <summary>
/// 损失血量百分比
/// </summary>
func (this *HealthPoint) LostPercent() float32 {
return FixedPoint_Divide((this.CurrMaxHp.Fixed() - this.Hp.Fixed()), this.CurrMaxHp.Fixed()).Scalar()
}
/// <summary>
/// 指定百分比血量
/// </summary>
func (this *HealthPoint) PercentHealth(pct float32) float32 {
return FixedPoint_Multiply(this.CurrMaxHp.Fixed(), NewFixedPoint(pct)).Scalar()
}
/// <summary>
/// 扣除的血量
/// </summary>
func (this *HealthPoint) Deduct() float32 {
return FixedPoint(this.CurrMaxHp.Fixed() - this.Hp.Fixed()).Scalar()
}
/// <summary>
/// 是否满血
/// </summary>
func (this *HealthPoint) IsFull() bool {
return this.Hp.Fixed() == this.CurrMaxHp.Fixed()
}

View File

@ -0,0 +1,9 @@
package buff
func NewFightBuff() *FightBuff {
return &FightBuff{}
}
type FightBuff struct {
FightBuffBase
}

View File

@ -0,0 +1,41 @@
package buff
type FightBuffBase struct {
}
/// 激活Buff
func (this FightBuffBase) Activate() {
}
/// 结束Buff
func (this FightBuffBase) End() {
}
/// 增加CD回合数
func (this FightBuffBase) AddCD(pVal int32) int32 {
return 0
}
/// 减少CD回合数
func (this FightBuffBase) MinusCD(pVal int32) int32 {
return 0
}
/// 设置CD回合数为新的值
func (this FightBuffBase) SetCD(newVal int32) int32 {
return 0
}
/// <summary>
/// 是否存在指定Tag
/// </summary>
func (this FightBuffBase) HasTag(pTag string) bool {
return false
}
/// 战斗结束时的清理
func (this FightBuffBase) Clear() {
}

View File

@ -0,0 +1,9 @@
package buff
func NewFightPoisonBuff() *FightPoisonBuff {
return &FightPoisonBuff{}
}
type FightPoisonBuff struct {
FightBuff
}

View File

@ -0,0 +1,9 @@
package buff
func NewFightProPercentBuff(proType int, quaType bool) *FightProPercentBuff {
return &FightProPercentBuff{}
}
type FightProPercentBuff struct {
FightBuff
}

View File

@ -0,0 +1,9 @@
package buff
func NewFightShieldBuff() *FightShieldBuff {
return &FightShieldBuff{}
}
type FightShieldBuff struct {
FightBuff
}

View File

@ -1,8 +1,125 @@
package core package core
import "go_dreamfactory/modules/battle/fight/buff"
type BuffStore struct { type BuffStore struct {
/// <summary> /// <summary>
/// 已经添加的buff类型 /// 已经添加的buff类型
/// </summary> /// </summary>
HasBuffTypes []int HasBuffTypes []int
/// <summary>
/// Buff列表 [BuffId, FightBuff]
/// </summary>
Buffs map[int][]IBuff
temp []int
}
func (this *BuffStore) CreateBuff(pType BuffType) IBuff {
switch pType {
case BuffType_NONE:
break
case BuffType_ATKUP:
return buff.NewFightProPercentBuff(PropertyType_Buff_Per_Atk, false)
case BuffType_DEFUP:
return buff.NewFightProPercentBuff(PropertyType_Buff_Per_Def, false)
case BuffType_SPDUP:
return buff.NewFightProPercentBuff(PropertyType_Buff_Per_Agi, false)
case BuffType_CRATEUP:
return buff.NewFightProPercentBuff(PropertyType_Add_Cri, false)
case BuffType_CRITRESIST:
break
case BuffType_ATKDOWN:
return buff.NewFightProPercentBuff(PropertyType_Buff_Per_Atk, true)
case BuffType_DEFDOWN:
return buff.NewFightProPercentBuff(PropertyType_Buff_Per_Def, true)
case BuffType_SPDDOWN:
return buff.NewFightProPercentBuff(PropertyType_Buff_Per_Agi, true)
case BuffType_CRATEDOWN:
return buff.NewFightProPercentBuff(PropertyType_Add_Cri, true)
case BuffType_MISSRATEUP:
return buff.NewFightProPercentBuff(PropertyType_LostHold_per, false)
case BuffType_SEAR:
break
case BuffType_INVINCIBILITY:
return buff.NewFightBuff()
case BuffType_STANDOFF:
break
case BuffType_STUN:
return buff.NewFightBuff()
case BuffType_FREEZE:
return buff.NewFightBuff()
case BuffType_DISEASED:
return buff.NewFightBuff()
case BuffType_PETRIFICATION:
return buff.NewFightBuff()
case BuffType_SILENCE:
return buff.NewFightBuff()
case BuffType_TAUNT:
break
case BuffType_IMMUNITY:
return buff.NewFightBuff()
case BuffType_SHIELD:
return buff.NewFightShieldBuff()
case BuffType_NOTSPEED:
return buff.NewFightBuff()
case BuffType_DAMREUP:
return buff.NewFightProPercentBuff(PropertyType_DamRe_Per, true)
case BuffType_HPUP:
return buff.NewFightProPercentBuff(PropertyType_Add_Per_Hp, false)
case BuffType_EFFHITUP:
return buff.NewFightProPercentBuff(PropertyType_Add_EffHit, false)
case BuffType_EFFREUP:
return buff.NewFightProPercentBuff(PropertyType_Add_EffRe, false)
case BuffType_HPDOWN:
break
case BuffType_EFFHITDOWN:
return buff.NewFightProPercentBuff(PropertyType_Add_EffHit, true)
case BuffType_EFFREDOWN:
return buff.NewFightProPercentBuff(PropertyType_Add_EffRe, true)
case BuffType_CAUSEDAMUP:
return buff.NewFightProPercentBuff(PropertyType_CauseDam_Per, false)
case BuffType_POISON:
return buff.NewFightPoisonBuff()
case BuffType_ATTRTRANS:
break
case BuffType_UNDEAD:
break
case BuffType_DEVOUR:
break
case BuffType_DONTMISS:
break
case BuffType_NOTGAIN:
break
case BuffType_NOTCONTROL:
break
case BuffType_SLEEP:
break
}
return buff.NewFightBuff()
}
func (this *BuffStore) ForEach(action func(IBuff)) {
this.temp = this.temp[:0]
for k, _ := range this.Buffs {
this.temp = append(this.temp, k)
}
for _, v := range this.temp {
list := this.Buffs[v]
for _, v1 := range list {
action(v1)
}
}
}
func (this *BuffStore) HasBuff(judge func(IBuff) bool) bool {
for _, v := range this.Buffs {
for _, buff := range v {
if judge(buff) {
return true
}
}
}
return false
}
func (this *BuffStore) Clear() {
this.Buffs = make(map[int][]IBuff)
} }

View File

@ -0,0 +1,162 @@
package core
type BuffType int
const (
/// <summary>
/// 无效类型
/// </summary>
BuffType_NONE = 0
/// <summary>
/// 攻击提升
/// </summary>
BuffType_ATKUP = 1
/// <summary>
/// 防御提升
/// </summary>
BuffType_DEFUP = 2
/// <summary>
/// 速度提升
/// </summary>
BuffType_SPDUP = 3
/// <summary>
/// 暴击提升
/// </summary>
BuffType_CRATEUP = 4
/// <summary>
/// 暴击抵抗
/// </summary>
BuffType_CRITRESIST = 5
/// <summary>
/// 攻击下降
/// </summary>
BuffType_ATKDOWN = 6
/// <summary>
/// 防御下降
/// </summary>
BuffType_DEFDOWN = 7
/// <summary>
/// 速度下降
/// </summary>
BuffType_SPDDOWN = 8
/// <summary>
/// 暴击下降
/// </summary>
BuffType_CRATEDOWN = 9
/// <summary>
/// 烙印
/// </summary>
BuffType_SEAR = 10
/// <summary>
/// 失手率提升
/// </summary>
BuffType_MISSRATEUP = 11
/// <summary>
/// 无敌
/// </summary>
BuffType_INVINCIBILITY = 12
/// <summary>
/// 对峙
/// </summary>
BuffType_STANDOFF = 13
/// <summary>
/// 眩晕
/// </summary>
BuffType_STUN = 14
/// <summary>
/// 冰冻
/// </summary>
BuffType_FREEZE = 15
/// <summary>
/// 禁疗
/// </summary>
BuffType_DISEASED = 16
/// <summary>
/// 石化
/// </summary>
BuffType_PETRIFICATION = 17
/// <summary>
/// 沉默
/// </summary>
BuffType_SILENCE = 18
/// <summary>
/// 挑衅
/// </summary>
BuffType_TAUNT = 19
/// <summary>
/// 免疫
/// </summary>
BuffType_IMMUNITY = 20
/// <summary>
/// 护盾
/// </summary>
BuffType_SHIELD = 21
/// <summary>
/// 不可移动
/// </summary>
BuffType_NOTSPEED = 22
/// <summary>
/// 受到伤害降低
/// </summary>
BuffType_DAMREUP = 23
/// <summary>
/// 血量提升
/// </summary>
BuffType_HPUP = 24
/// <summary>
/// 效果命中提升
/// </summary>
BuffType_EFFHITUP = 25
/// <summary>
/// 效果抵抗提升
/// </summary>
BuffType_EFFREUP = 26
/// <summary>
/// 血量下降
/// </summary>
BuffType_HPDOWN = 27
/// <summary>
/// 效果命中下降
/// </summary>
BuffType_EFFHITDOWN = 28
/// <summary>
/// 效果抵抗下降
/// </summary>
BuffType_EFFREDOWN = 29
/// <summary>
/// 伤害提升增加
/// </summary>
BuffType_CAUSEDAMUP = 30
/// <summary>
/// 中毒
/// </summary>
BuffType_POISON = 31
/// <summary>
/// 属性转换
/// </summary>
BuffType_ATTRTRANS = 32
/// <summary>
/// 不死
/// </summary>
BuffType_UNDEAD = 33
/// <summary>
/// 吞噬
/// </summary>
BuffType_DEVOUR = 34
/// <summary>
/// 不会失手
/// </summary>
BuffType_DONTMISS = 35
/// <summary>
/// 不能获得增益buff
/// </summary>
BuffType_NOTGAIN = 36
/// <summary>
/// 免疫控制
/// </summary>
BuffType_NOTCONTROL = 37
/// <summary>
/// 睡眠
/// </summary>
BuffType_SLEEP = 38
)

View File

@ -48,7 +48,7 @@ type (
/// </summary> /// </summary>
/// <param name="skillId">技能id</param> /// <param name="skillId">技能id</param>
/// <param name="skillLv">技能等级</param> /// <param name="skillLv">技能等级</param>
AddSkill(skillId int32, skillLv int32) ISkil AddSkill(skillId int32, skillLv int32) ISkill
/// 获取行动令牌 /// 获取行动令牌
StartAction() StartAction()
/// 结束行动令牌 /// 结束行动令牌
@ -71,7 +71,7 @@ type (
/// 获取下一个技能id /// 获取下一个技能id
GetNextSkillId() int32 GetNextSkillId() int32
/// 获取后续子技能 /// 获取后续子技能
GetAfterAtk(skillId int) ISkil GetAfterAtk(skillId int) ISkill
/// 触发SkillId技能选择的目标是TargetRid /// 触发SkillId技能选择的目标是TargetRid
EmitSkill(skillId int32, targetRid []int32) EmitSkill(skillId int32, targetRid []int32)
/// 自身的 Buff 和 被动 是否有指定标签 /// 自身的 Buff 和 被动 是否有指定标签
@ -85,7 +85,7 @@ type (
AutoEmitSkill(pFightRole IFightRole) AutoEmitSkill(pFightRole IFightRole)
} }
//技能对象 //技能对象
ISkil interface { ISkill interface {
/// <summary> /// <summary>
/// 获取技能配置信息 /// 获取技能配置信息
/// </summary> /// </summary>
@ -120,6 +120,12 @@ type (
///</summary> ///</summary>
SendSkillLog() SendSkillLog()
} }
IAfterSkill interface {
/// <summary>
/// 战斗结束时的清理
/// </summary>
Clear()
}
//Buff对象 //Buff对象
IBuff interface { IBuff interface {
/// 激活Buff /// 激活Buff

View File

@ -104,6 +104,10 @@ type FightRoleData struct {
///region 技能相关----------------------------------------------------------------------- ///region 技能相关-----------------------------------------------------------------------
/// <summary> /// <summary>
/// 技能信息 id:lv
/// </summary>
SkillsInfo []ISkill
/// <summary>
/// 最后一次选择的skillAtk类技能 /// 最后一次选择的skillAtk类技能
/// </summary> /// </summary>
LastSkillId int32 LastSkillId int32
@ -117,10 +121,19 @@ type FightRoleData struct {
/// <remarks> /// <remarks>
/// 在角色初始化时会根据SkillsInfo实例化对应的技能保存于此 /// 在角色初始化时会根据SkillsInfo实例化对应的技能保存于此
/// </remarks> /// </remarks>
Skills map[int32]ISkil Skills map[int32]ISkill
/// <summary>
/// AfterAtk集合
/// </summary>
AfterSkills map[int]IAfterSkill
/// <summary> /// <summary>
/// BUFF集合 /// BUFF集合
/// </summary> /// </summary>
BuffStore *BuffStore BuffStore *BuffStore
/// <summary>
/// 被动技能集合
/// </summary>
PassiveStore PassiveStore
} }

View File

@ -0,0 +1,31 @@
package core
import "go_dreamfactory/modules/battle/fight/passive"
type PassiveStore struct {
Passives map[int]passive.IFightPassive
temp []int
}
func (this *PassiveStore) CreatePassive(pType string) passive.IFightPassive {
switch pType {
case "CallSkillPas":
return passive.NewFightCallSkillPas()
}
return nil
}
func (this *PassiveStore) ForEach(action func(fp passive.IFightPassive)) {
this.temp = make([]int, 0)
for k, _ := range this.Passives {
this.temp = append(this.temp, k)
}
for _, v := range this.temp {
action(this.Passives[v])
}
}
func (this *PassiveStore) RemovePassive(id int) {
}
func (this *PassiveStore) Clear() {
this.Passives = make(map[int]passive.IFightPassive)
}

View File

@ -0,0 +1,174 @@
package core
type PropertyType int
const (
/// <summary>
/// 总生命
/// </summary>
PropertyType_Total_Hp = 1
/// <summary>
/// 当前总生命
/// </summary>
PropertyType_NowTotal_Hp = 2
/// <summary>
/// 当前生命
/// </summary>
PropertyType_NowHp = 3
/// <summary>
/// 总攻击
/// </summary>
PropertyType_Total_Atk = 4
/// <summary>
/// 总防御
/// </summary>
PropertyType_Total_Def = 5
/// <summary>
/// 总速度
/// </summary>
PropertyType_Total_Agi = 6
/// <summary>
/// 总暴击率
/// </summary>
PropertyType_Total_Cri = 7
/// <summary>
/// 总暴击伤害
/// </summary>
PropertyType_Total_CriDam = 8
/// <summary>
/// 总效果命中
/// </summary>
PropertyType_Total_EffHit = 9
/// <summary>
/// 总效果抵抗
/// </summary>
PropertyType_Total_EffRe = 10
/// <summary>
/// 已损失生命值
/// </summary>
PropertyType_LostHp = 11
/// <summary>
/// 已损失生命值百分比
/// </summary>
PropertyType_LostPerHp = 12
/// <summary>
/// 当前生命百分比
/// </summary>
PropertyType_NowHp_Per = 13
/// <summary>
/// 附加生命(修改属性类型从这里开始)
/// </summary>
PropertyType_Add_Hp = 14
/// <summary>
/// 附加百分比生命
/// </summary>
PropertyType_Add_Per_Hp = 15
/// <summary>
/// BUFF附加生命
/// </summary>
PropertyType_Buff_Hp = 16
/// <summary>
/// BUFF附加百分比生命
/// </summary>
PropertyType_Buff_Per_Hp = 17
/// <summary>
/// 附加攻击
/// </summary>
PropertyType_Add_Atk = 18
/// <summary>
/// 附加百分比攻击
/// </summary>
PropertyType_Add_Per_Atk = 19
/// <summary>
/// BUFF附加攻击
/// </summary>
PropertyType_Buff_Atk = 20
/// <summary>
/// BUFF附加百分比攻击
/// </summary>
PropertyType_Buff_Per_Atk = 21
/// <summary>
/// 附加防御
/// </summary>
PropertyType_Add_Def = 22
/// <summary>
/// 附加百分比防御
/// </summary>
PropertyType_Add_Per_Def = 23
/// <summary>
/// BUFF附加防御
/// </summary>
PropertyType_Buff_Def = 24
/// <summary>
/// BUFF附加百分比防御
/// </summary>
PropertyType_Buff_Per_Def = 25
/// <summary>
/// 附加速度
/// </summary>
PropertyType_Add_Agi = 26
/// <summary>
/// 附加百分比速度
/// </summary>
PropertyType_Add_Per_Agi = 27
/// <summary>
/// BUFF附加速度
/// </summary>
PropertyType_Buff_Agi = 28
/// <summary>
/// BUFF附加百分比速度
/// </summary>
PropertyType_Buff_Per_Agi = 29
/// <summary>
/// 附加暴击率
/// </summary>
PropertyType_Add_Cri = 30
/// <summary>
/// 附加暴击伤害
/// </summary>
PropertyType_Add_CriDam = 31
/// <summary>
/// 附加效果命中
/// </summary>
PropertyType_Add_EffHit = 32
/// <summary>
/// 附加效果抵抗
/// </summary>
PropertyType_Add_EffRe = 33
/// <summary>
/// 行动值
/// </summary>
PropertyType_ActValue = 34
/// <summary>
/// 伤害减免(buff附加百分比)
/// </summary>
PropertyType_DamRe_Per = 35
/// <summary>
/// 伤害提升(buff附加百分比)
/// </summary>
PropertyType_CauseDam_Per = 36
/// <summary>
/// 伤害减免(固定值)
/// </summary>
PropertyType_DamRe = 37
/// <summary>
/// 伤害提升(固定值)
/// </summary>
PropertyType_CauseDam = 38
/// <summary>
/// 失手率buff增加百分比
/// </summary>
PropertyType_LostHold_per = 39
/// <summary>
/// 会心率buff增加百分比
/// </summary>
PropertyType_UnderStand_per = 40
/// <summary>
/// 治疗加成
/// </summary>
PropertyType_TreAdd = 41
/// <summary>
/// 受疗加成
/// </summary>
PropertyType_BeTreAdd = 42
)

View File

@ -1,8 +1,10 @@
package fight package fight
import ( import (
"fmt"
"go_dreamfactory/modules/battle/fight/attribute" "go_dreamfactory/modules/battle/fight/attribute"
"go_dreamfactory/modules/battle/fight/core" "go_dreamfactory/modules/battle/fight/core"
"go_dreamfactory/modules/battle/fight/passive"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
) )
@ -52,3 +54,36 @@ func (this *FightRole) IsDead() bool {
func (this *FightRole) Dead() { func (this *FightRole) Dead() {
this.data.ALive = false this.data.ALive = false
} }
/// <summary>
/// 战斗结束时的清理
/// </summary>
func (this *FightRole) Clear() {
//清理所有技能
for _, v := range this.data.Skills {
v.Clear()
}
//清理所有攻击后技能
for _, v := range this.data.AfterSkills {
v.Clear()
}
//清理所有buff
this.data.BuffStore.ForEach(func(buff core.IBuff) {
buff.Clear()
})
// //清理所有被动就能
this.data.PassiveStore.ForEach(func(fp passive.IFightPassive) {
fp.Clear()
})
//清空
this.data.Skills = make(map[int32]core.ISkill)
this.data.AfterSkills = make(map[int]core.IAfterSkill)
this.data.BuffStore.Clear()
this.data.PassiveStore.Clear()
}
func (this *FightRole) ToString() string {
return fmt.Sprintf("[%s]", this.data.Name)
}

View File

@ -0,0 +1,12 @@
package passive
func NewFightCallSkillPas() IFightPassive {
return &FightCallSkillPas{}
}
/// <summary>
/// 通用调用技能和子技能
/// </summary>
type FightCallSkillPas struct {
FightPassive
}

View File

@ -0,0 +1,12 @@
package passive
type IFightPassive interface {
Clear()
}
type FightPassive struct {
}
func (this *FightPassive) Clear() {
}

View File

@ -0,0 +1,15 @@
package skill
type FightAfterSkill struct {
/// <summary>
/// 技能效果是否生效
/// </summary>
TakeEffect bool
}
/// <summary>
/// 战斗结束时的清理
/// </summary>
func (this *FightAfterSkill) Clear() {
this.TakeEffect = false
}