// 后减 public void castDecSkill(float rate, int angryCost = 0) { BT_Logical war = owner._war; BT_MonsterTeam selfTeam = owner.ownerTeam; if (angryCost > 0) // 扣怒气... { selfTeam.costAngry(angryCost); } // 减血 CMsgSkillRecovery msg = new CMsgSkillRecovery(this); msg.startAtt = owner.curAtt; war.addMsgToRecorder(msg); float finalAtt = owner.curAtt * (1 - rate * Consts.oneHundred); if (finalAtt < 1) { finalAtt = 1; } // 减血 owner.setCurAtt(finalAtt); msg.finalAtt = MathHelper.MidpointRounding(finalAtt); msg.suffer = owner.pveId; }
// 先增后减 private void castIncDecSkill(float rate, int num, int angryCost = 0) { BT_Logical war = owner._war; BT_MonsterTeam selfTeam = owner.ownerTeam; if (angryCost > 0) // 扣怒气... { selfTeam.costAngry(angryCost); } short bufType = CMsgHeader.BUFF_DEBUFF_REDUCE_HP; int bufRound = 2; // 加血 CMsgSkillRecovery msg = new CMsgSkillRecovery(this); msg.startAtt = owner.curAtt; war.addMsgToRecorder(msg); BT_BuffOrDebuff buf = new BT_BuffOrDebuff() { type = bufType, round = bufRound, skill = this, }; owner.addBuffOrDebuff(buf); float finalAtt = owner.curAtt * (1 + rate * Consts.oneHundred); owner.setCurAtt(finalAtt); msg.curAngry = selfTeam.curAngry; msg.finalAtt = MathHelper.MidpointRounding(finalAtt); msg.suffer = owner.pveId; }