// TODO: 直接攻击型技能 // 对对方造成damage的伤害... private CMsgSkillAttack makeAttackMsg(BT_Monster enemy, float damage) { BT_Hurt hurt = new BT_Hurt() { damageVal = damage, hurtType = BT_Hurt_Type.HURT_SKILL, }; CMsgSkillAttack msg = new CMsgSkillAttack(this, enemy.pveId, MathHelper.MidpointRounding(damage)); int finalDamage = enemy.sufferAttack(hurt, owner); msg.finalAtt = finalDamage; msg.curAtt = enemy.curAtt; msg.curAngry = enemy.ownerTeam.curAngry; return(msg); }
// damage 伤害 // angryCost 怒气的消耗 // angryRecover 怒气的恢复 private void castAttackSkill(int damage, int angryCost = 0, int angryRecover = 0) { BT_Logical war = owner._war; BT_Monster enemy = war.enemy(owner); if (enemy.alive) { // 扣怒气... owner.ownerTeam.costAngry(angryCost); int angry = owner.ownerTeam.curAngry; owner.ownerTeam.addAngry(angryRecover); CMsgSkillAttack msg = makeAttackMsg(enemy, damage); msg.recoverAngry = angryRecover; msg.costAngry = angryCost; msg.preAngry = angry; war.addMsgToRecorder(msg); } }
// TODO: 自爆技能 // type 0:固定值 1:自身初始战斗比例 2:对方当前战斗比例 private void castBlastSkill(float damage, int type, int sufferCnt = 1, int angryCost = 0) { BT_Logical war = owner._war; BT_MonsterTeam enemyTeam = owner.vsTeam; CMsgSkillBlast msg = new CMsgSkillBlast(this); war.addMsgToRecorder(msg); if (1 == type) { damage = owner.initAtt * damage * Consts.oneHundred; } int teamLen = enemyTeam._team.Count; int sufferNum = 0; List <CMsgSkillAttack> temp = new List <CMsgSkillAttack>(); for (int i = enemyTeam.curPetTeamIndex; i < teamLen && sufferNum < sufferCnt; i++, sufferNum++) { BT_Monster enemy = enemyTeam._team [i]; if (2 == type) { if (war.fightDiff != 0) { damage = war.fightDiff * damage * Consts.oneHundred; } else { damage = enemy.curAtt * damage * Consts.oneHundred; } } CMsgSkillAttack attackMsg = makeAttackMsg(enemy, damage); temp.Add(attackMsg); } msg.sufferArr = temp.ToArray(); }
// TODO: 连击技能... // 对对方造成damage的伤害 并且可能有额外几次的伤害... private void castAttackComboSkill(float damage, int extra, int angryCost = 0) { BT_Logical war = owner._war; BT_Monster enemy = war.enemy(owner); if (enemy.alive) { CMsgSkillAttackCombo msg = new CMsgSkillAttackCombo(this); BT_MonsterTeam selfTeam = owner.ownerTeam; // 扣怒气... if (angryCost > 0) { selfTeam.costAngry(angryCost); } war.addMsgToRecorder(msg); // 返回当前的怒气值 msg.curAngry = selfTeam.curAngry; msg.attackArr = null; List <CMsgSkillAttack> realArr = new List <CMsgSkillAttack>(); for (int i = 0; i < extra + 1; i++) { if (enemy.alive) { CMsgSkillAttack attackMsg = makeAttackMsg(enemy, damage); realArr.Add(attackMsg); } } if (realArr.Count > 0) { msg.attackArr = realArr.ToArray(); } } }