// TODO: 变更当前攻击力技能 // 增加 自己/对手 当前战斗力X% type:0---百分比 1---固定值 private void castChangeAttackSkill(bool beOwner, float addRate, int type = 0, int angryCost = 0) { BT_Logical war = owner._war; BT_Monster enemy = war.enemy(owner); BT_Monster target = beOwner ? owner : enemy; if (target.alive) { if (angryCost > 0) // 扣怒气... { BT_MonsterTeam selfTeam = owner.ownerTeam; selfTeam.costAngry(angryCost); } CMsgSkillChangeAttack msg = new CMsgSkillChangeAttack(this, target.pveId); int beforeAtt = target.curAtt; if (0 == type) { if (beOwner) { target.curAttEnhance(1 + addRate * 0.01f); } else { int hp = target.curAtt; float damage = hp * addRate * 0.01f; damage = returnDamage(owner, enemy, damage); if (false == target.canSufferSkillDamage()) { damage = 0; } target.curAttAdd(-damage); // target.curAttEnhance ( 1 - addRate / 100 ); } } else { target.curAttAdd(addRate); } int afterAtt = target.curAtt; msg.curAtt = afterAtt; msg.addAtt = afterAtt - beforeAtt; war.addMsgToRecorder(msg); } }
// TODO: 自损技能 // type 0:固定值 1:比例 private void castChangeAttBothSKill(int snum, int stype, int senum, int etype, int angryCost = 0) { BT_Logical war = owner._war; BT_Monster enemy = war.enemy(owner); if (enemy.alive) { if (angryCost > 0) // 扣怒气... { BT_MonsterTeam selfTeam = owner.ownerTeam; selfTeam.costAngry(angryCost); } float sAdd = snum; if (stype == 1) { sAdd = snum * Consts.oneHundred * owner.curAtt; } float eAdd = senum; if (etype == 1) { eAdd = senum * Consts.oneHundred * enemy.curAtt; } sAdd = -sAdd; eAdd = -eAdd; CMsgSkillChangeCurAttackBoth msg = new CMsgSkillChangeCurAttackBoth(this); war.addMsgToRecorder(msg); owner.curAttAdd(sAdd); if (enemy.canSufferSkillDamage()) { enemy.curAttAdd(eAdd); } msg.selfAttChange = MathHelper.MidpointRounding(sAdd); msg.enemyAttChange = MathHelper.MidpointRounding(eAdd); msg.selfCurAtt = owner.curAtt; msg.enemyCurAtt = enemy.curAtt; } }