/// <summary> /// 释放技能效果 /// </summary> public virtual void DoSkill() { if (card == null || card.IsDead) { return; } List <BaseFighter> targetList = card.owner.GetTargetByType(this, TargetType); if (targetList.Count == 0) { return; } List <int> cardIDs = GetTargetID(targetList); card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, cardIDs)); foreach (BaseFighter target in targetList) { if (target != null && !target.IsDead) { _DoSkill(target); } } // card.Actions.Add(SkillEndAction.GetAction(card.ID, skillID)); }
void OnAttackSucc(FighterEvent e) { BaseBuff buff = BuffFactory.GetBuffByID(BuffID, skillLevel); card.attacker.AddBuff(buff); card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); }
// 死亡后还原攻击 void OnDead(FighterEvent e) { card.RemoveEventListener(BattleEventType.ON_CARD_DEAD, OnDead); List <BaseFighter> targetList = card.owner.GetTargetByType(this, TargetType); card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(targetList))); if (targetList != null || targetList.Count == 0) { return; } // 在场的同国家增加攻击力 foreach (CardFighter target in targetList) { target.DeductAttack(attackUp); } // 不在场的增加出场回调 targetList = card.owner.GetTargetByCountry(card.cardData.country); foreach (CardFighter target in targetList) { if (target == card) { continue; } target.RemoveEventListener(BattleEventType.ON_CARD_PRESENT, OnOtherCardPresent); } }
/// <summary> /// 横扫技能效果,中间卡牌收到的伤害作为旁边二张卡牌的攻击力 /// </summary> public override void DoSkill() { if (card == null || card.IsDead || card.Attack <= 0) { return; } List <BaseFighter> targetList = card.owner.GetTargetByType(this, TargetType); if (targetList.Count == 0) { return; } if (targetList.Count == 1 && targetList[0] is PlayerFighter) { SkillFactory.GetAttackSkill(card).DoSkill(); return; } List <int> cardIDs = GetTargetID(targetList); card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, cardIDs)); BaseFighter fighter = targetList[0]; int damage = fighter.OnAttackHurt(card, card.Attack); for (int i = 1; i < targetList.Count; i++) { fighter = targetList[i]; fighter.OnAttackHurt(card, damage); } // card.Actions.Add(SkillEndAction.GetAction(card.ID, skillID)); }
// 攻击成功后提示攻击力 void OnAttackSucc(FighterEvent e) { if (card.lastAttackValue > 0) { card.AddAttack(addAtt); card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); } }
// 受攻击前减少伤害 void OnAfterAttackHurt(FighterEvent e) { if (card.attacker != null && !card.attacker.IsDead) { card.attacker.OnHurt(damage); card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); } }
// 闪避攻击 void OnPreAttackHurt(FighterEvent e) { if (Random.Range(0, 100) < rate) { card.lastHurtValue = 0; card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); } }
// 50%概率进入等待区 void OnCardDead(FighterEvent e) { if (Random.Range(0, 100) < rate) { card.DoWait(); card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); } }
// 伤害后吸血 void OnAttackSucc(FighterEvent e) { if (card.lastAttackValue > 0) { card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); card.AddHp((int)(card.lastAttackValue * rate / 100f)); } }
// 攻击成功后提示攻击力 void OnAttackSucc(FighterEvent e) { if (card.lastAttackValue > 0) { card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); BaseBuff buff = BuffFactory.GetBuffByID(BuffID, skillLevel); card.target.AddBuff(buff); } }
// 攻击前判断暴击 void OnPreAttack(FighterEvent e) { card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); // 触发暴击 card.AddAttack(attackUp); card.AddEventListener(BattleEventType.ON_PRE_ATTACK, OnAfterAttack); }
// 最高受到伤害 void OnPreSkillHurt(FighterEvent e) { if (card.attackSkill.SkillType != (int)SkillMagicEnum.SKILL_MAAGIC_TYPE) { return; } card.lastHurtValue = Mathf.Min(maxHurt, card.lastHurtValue); card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); }
void OnOtherCardPresent(FighterEvent e) { CardFighter target = e.fighter as CardFighter; if (target == null) { return; } card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(target))); target.AddAttack(attackUp); }
// 攻击前判断暴击 void OnPreAttack(FighterEvent e) { if (Random.Range(0, 100) < rate) { card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); // 触发暴击 attackUp = (int)(card.Attack * attackUpRate / 100f); card.AddAttack(attackUp); card.AddEventListener(BattleEventType.ON_PRE_ATTACK, OnAfterAttack); } }
// 魔法伤害无效,给攻击者反射伤害 void OnPreSkillHurt(FighterEvent e) { if (card.attackSkill.SkillType != (int)SkillMagicEnum.SKILL_MAAGIC_TYPE) { return; } card.lastAttackValue = 0; if (card.attacker != null && !card.attacker.IsDead) { card.attacker.OnHurt(damage); } card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); }
// 对对面以及相邻三张卡牌造成100点伤害 void OnCardDead(FighterEvent e) { List <BaseFighter> targetList = card.owner.GetTargetByType(this, TargetType); if (targetList != null || targetList.Count == 0) { return; } card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(targetList))); foreach (CardFighter target in targetList) { if (target.CanDoSkill() && !target.IsDead) { target.OnHurt(damage); } } }
// 攻击前判断暴击 void OnPreAttack(FighterEvent e) { List <BaseFighter> targets = card.owner.GetTargetByType(this, TargetType); if (targets == null || targets.Count == 0) { return; } CardFighter target = targets[0] as CardFighter; if (target != null && target.cardData.country == enemyType) { card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); // 触发暴击 attackUp = (int)(card.Attack * attackUpRate / 100f); card.AddAttack(attackUp); card.AddEventListener(BattleEventType.ON_PRE_ATTACK, OnAfterAttack); } }
// 最高受到伤害 void OnCheckImmune(FighterEvent e) { card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); }
// 提升30点攻击力 void OnAfterAttackHurt(FighterEvent e) { card.AddAttack(addAtt); card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); }
// 最高受到伤害 void OnPreAttackHurt(FighterEvent e) { card.lastHurtValue = Mathf.Min(maxHurt, card.lastHurtValue); card.Actions.Add(SkillStartAction.GetAction(card.ID, skillID, GetTargetID(card))); }