feat: 支持多精灵战斗位操作
This commit is contained in:
@@ -30,11 +30,11 @@ func (our *Input) CalculateCrit(opp *Input, skill *info.SkillEntity) {
|
||||
CritRate = 16
|
||||
}
|
||||
// CritSelfHalfHp: 自身体力低于一半时必定致命一击; 默认: 0
|
||||
if skill.XML.CritSelfHalfHp != 0 && (our.CurrentPet.HP < int(our.CurrentPet.Info.MaxHp)/2) {
|
||||
if skill.XML.CritSelfHalfHp != 0 && (our.CurrentPet[0].HP < int(our.CurrentPet[0].Info.MaxHp)/2) {
|
||||
CritRate = 16
|
||||
}
|
||||
// CritFoeHalfHp: 对方体力低于一半时必定致命一击; 默认: 0
|
||||
if skill.XML.CritSelfHalfHp != 0 && (opp.CurrentPet.HP < int(opp.CurrentPet.Info.MaxHp)/2) {
|
||||
if skill.XML.CritSelfHalfHp != 0 && (opp.CurrentPet[0].HP < int(opp.CurrentPet[0].Info.MaxHp)/2) {
|
||||
CritRate = 16
|
||||
}
|
||||
|
||||
@@ -67,30 +67,30 @@ func (our *Input) Heal(in *Input, ac action.BattleActionI, value alpacadecimal.D
|
||||
}
|
||||
|
||||
if healValue >= 0 {
|
||||
our.CurrentPet.Info.ModelHP(int64(healValue))
|
||||
our.CurrentPet[0].Info.ModelHP(int64(healValue))
|
||||
return
|
||||
}
|
||||
|
||||
damage := uint32(-healValue)
|
||||
if damage >= our.CurrentPet.Info.Hp {
|
||||
our.CurrentPet.Info.Hp = 0
|
||||
if damage >= our.CurrentPet[0].Info.Hp {
|
||||
our.CurrentPet[0].Info.Hp = 0
|
||||
return
|
||||
}
|
||||
our.CurrentPet.Info.Hp -= damage
|
||||
our.CurrentPet[0].Info.Hp -= damage
|
||||
|
||||
}
|
||||
func (our *Input) HealPP(value int) {
|
||||
|
||||
our.CurrentPet.Info.HealPP(value)
|
||||
our.CurrentPet[0].Info.HealPP(value)
|
||||
|
||||
}
|
||||
func (our *Input) DelPP(value int) {
|
||||
|
||||
for i := 0; i < len(our.CurrentPet.Info.SkillList); i++ {
|
||||
if uint32(value) > our.CurrentPet.Info.SkillList[i].PP {
|
||||
our.CurrentPet.Info.SkillList[i].PP = 0
|
||||
for i := 0; i < len(our.CurrentPet[0].Info.SkillList); i++ {
|
||||
if uint32(value) > our.CurrentPet[0].Info.SkillList[i].PP {
|
||||
our.CurrentPet[0].Info.SkillList[i].PP = 0
|
||||
} else {
|
||||
our.CurrentPet.Info.SkillList[i].PP -= uint32(value)
|
||||
our.CurrentPet[0].Info.SkillList[i].PP -= uint32(value)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -196,11 +196,11 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
|
||||
|
||||
}
|
||||
|
||||
if uint32(sub.Damage.IntPart()) > our.CurrentPet.Info.Hp {
|
||||
if uint32(sub.Damage.IntPart()) > our.CurrentPet[0].Info.Hp {
|
||||
|
||||
our.CurrentPet.Info.Hp = 0
|
||||
our.CurrentPet[0].Info.Hp = 0
|
||||
} else {
|
||||
our.CurrentPet.Info.Hp = our.CurrentPet.Info.Hp - uint32(sub.Damage.IntPart())
|
||||
our.CurrentPet[0].Info.Hp = our.CurrentPet[0].Info.Hp - uint32(sub.Damage.IntPart())
|
||||
}
|
||||
|
||||
//todo 待实现死亡effet
|
||||
@@ -211,7 +211,7 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
|
||||
func (our *Input) CalculatePower(deftype *Input, skill *info.SkillEntity) alpacadecimal.Decimal {
|
||||
|
||||
// 1. 计算等级因子 (level * 0.4 + 2)
|
||||
levelFactor := alpacadecimal.NewFromInt(int64(our.CurrentPet.Info.Level)).
|
||||
levelFactor := alpacadecimal.NewFromInt(int64(our.CurrentPet[0].Info.Level)).
|
||||
Mul(alpacadecimal.NewFromFloat(0.4)).Add(alpacadecimal.NewFromInt(2))
|
||||
|
||||
var (
|
||||
@@ -239,17 +239,17 @@ func (our *Input) CalculatePower(deftype *Input, skill *info.SkillEntity) alpaca
|
||||
// 11. DmgBindHpDv: 造成的伤害等于自身剩余体力*1/2+潜力(个体值); 默认: 0
|
||||
if skill.XML.DmgBindLv != 0 {
|
||||
|
||||
skill.XML.Power = int(deftype.CurrentPet.Info.Level)
|
||||
skill.XML.Power = int(deftype.CurrentPet[0].Info.Level)
|
||||
|
||||
}
|
||||
if skill.XML.PwrBindDv != 0 {
|
||||
if skill.XML.PwrBindDv == 1 {
|
||||
|
||||
skill.XML.Power = int(our.CurrentPet.Info.Dv * 5)
|
||||
skill.XML.Power = int(our.CurrentPet[0].Info.Dv * 5)
|
||||
|
||||
}
|
||||
if skill.XML.PwrBindDv == 2 {
|
||||
skill.XML.Power = int(our.CurrentPet.Info.Hp/3 + our.CurrentPet.Info.Dv)
|
||||
skill.XML.Power = int(our.CurrentPet[0].Info.Hp/3 + our.CurrentPet[0].Info.Dv)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -261,7 +261,7 @@ func (our *Input) CalculatePower(deftype *Input, skill *info.SkillEntity) alpaca
|
||||
|
||||
}
|
||||
if skill.XML.DmgBindHpDv != 0 {
|
||||
skill.XML.Power = int(our.CurrentPet.Info.Hp/2 + our.CurrentPet.Info.Dv)
|
||||
skill.XML.Power = int(our.CurrentPet[0].Info.Hp/2 + our.CurrentPet[0].Info.Dv)
|
||||
|
||||
}
|
||||
// 5. 基础伤害公式:等级因子 * 威力因子 * 攻击 / 防御 / 50 + 2
|
||||
@@ -272,8 +272,8 @@ func (our *Input) CalculatePower(deftype *Input, skill *info.SkillEntity) alpaca
|
||||
Add(alpacadecimal.NewFromInt(2))
|
||||
|
||||
var typeRate alpacadecimal.Decimal
|
||||
//fmt.Println(skill.Type().ID, deftype.CurrentPet.Type().ID)
|
||||
t, _ := element.Calculator.GetOffensiveMultiplier(skill.GetType().ID, deftype.CurrentPet.GetType().ID)
|
||||
//fmt.Println(skill.Type().ID, deftype.CurrentPet[0].Type().ID)
|
||||
t, _ := element.Calculator.GetOffensiveMultiplier(skill.GetType().ID, deftype.CurrentPet[0].GetType().ID)
|
||||
our.AttackValue.Offensive = gconv.Float32(t)
|
||||
|
||||
typeRate = alpacadecimal.NewFromFloat(t)
|
||||
|
||||
Reference in New Issue
Block a user