// TODO: 自爆 private void castBombSkill(float rate, int angryCost = 0) { BT_Logical war = owner._war; BT_MonsterTeam selfTeam = owner.ownerTeam; if (angryCost > 0) // 扣怒气... { selfTeam.costAngry(angryCost); } BT_Monster enemy = war.enemy(owner); owner.setCurAtt(0, true); float damage = enemy.curAtt * rate * Consts.oneHundred; CMsgSkillBomb msg = new CMsgSkillBomb(this, enemy.pveId, MathHelper.MidpointRounding(damage)); war.addMsgToRecorder(msg); int finalDamage = enemy.sufferAttack(new BT_Hurt() { hurtType = BT_Hurt_Type.HURT_SKILL, damageVal = damage, }, owner); msg.finalAtt = finalDamage; msg.enemyCurAtt = enemy.curAtt; msg.selfCurAtt = owner.curAtt; }
// TODO: 夺取差值 private void castSkillAttDelta(float rate, int angryCost = 0) { BT_Logical war = owner._war; BT_MonsterTeam selfTeam = owner.ownerTeam; if (angryCost > 0) // 扣怒气... { selfTeam.costAngry(angryCost); } BT_Monster enemy = war.enemy(owner); if (owner.curAtt >= enemy.curAtt) { return; } float attDistance = Math.Abs(enemy.curAtt - owner.curAtt); attDistance = attDistance * rate * Consts.oneHundred; attDistance = enemy.sufferAttack(new BT_Hurt() { hurtType = BT_Hurt_Type.HURT_SKILL, damageVal = attDistance, }, owner); CMsgSkillAttDelta msg = new CMsgSkillAttDelta(this, MathHelper.MidpointRounding(attDistance)); war.addMsgToRecorder(msg); msg.beforeAtt = owner.curAtt; owner.curAttAdd(attDistance); msg.curAtt = owner.curAtt; msg.enemyAtt = enemy.curAtt; }
// TODO: 斩杀 private void castCutSkill(float damage, float rate, int angryCost = 0) { BT_Logical war = owner._war; BT_MonsterTeam selfTeam = owner.ownerTeam; if (angryCost > 0) // 扣怒气... { selfTeam.costAngry(angryCost); } BT_Monster enemy = war.enemy(owner); CMsgSkillCut msg = new CMsgSkillCut(this, enemy.pveId); msg.startAtt = MathHelper.MidpointRounding(damage); war.addMsgToRecorder(msg); int beforeAtt = enemy.curAtt; float cutAtt = enemy.initAtt * rate * Consts.oneHundred; enemy.sufferAttack(new BT_Hurt() { damageVal = damage, hurtType = BT_Hurt_Type.HURT_SKILL, }, owner); if (enemy.alive && enemy.curAtt < cutAtt) { enemy.setCurAtt(0); } msg.finalAtt = enemy.curAtt - beforeAtt; msg.curAtt = enemy.curAtt; }
// TODO: 吸血技能. // 吸取敌人攻击力,转换其中一部分变成自己的攻击力 // /num 吸取敌人血的百分比 // /type 0:固定值 1:比例 // /convert 吸取血之后加到自己身上的百分比 // /angryCost 怒气 // /selfInc 0:convert吸取血之后加到自己身上的百分比 1:自身攻击力增加convert private void castSuckSkill(float num, int type, float convert, int angryCost = 0, int selfInc = 0) { BT_Logical war = owner._war; BT_Monster enemy = war.enemy(owner); BT_MonsterTeam selfTeam = owner.ownerTeam; if (selfTeam.curAngry >= angryCost) { if (enemy.alive) { float suck = num; if (type == 1) { suck = num * Consts.oneHundred * enemy.curAtt; } if (suck > enemy.curAtt) { suck = enemy.curAtt; } if (angryCost > 0) // 扣怒气... { selfTeam.costAngry(angryCost); } CMsgSkillSuckAttack msg = new CMsgSkillSuckAttack(this, enemy.pveId, MathHelper.MidpointRounding(suck)); war.addMsgToRecorder(msg); // 减敌方血,加给自己. BT_Hurt hurt = new BT_Hurt() { damageVal = suck, hurtType = BT_Hurt_Type.HURT_SKILL, }; int finalSuck = enemy.sufferAttack(hurt, owner); float addAtt = 0f; if (selfInc == 0) { addAtt = convert * Consts.oneHundred * finalSuck; } else { addAtt = convert * Consts.oneHundred * owner.curAtt; } owner.curAttAdd(addAtt); msg.convertAttack = MathHelper.MidpointRounding(addAtt); msg.finalSuckAtt = finalSuck; msg.sufferCurAtt = enemy.curAtt; msg.casterCurAtt = owner.curAtt; msg.curAngry = selfTeam.curAngry; } } }
// 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); }