public BaoBian() { bbPaoXiao = null; bbShenSu = null; bbTiaoXin = null; var trigger = new AutoNotifyPassiveSkillTrigger( this, (p, e, a) => { Refresh(p); }, TriggerCondition.OwnerIsTarget ) { IsAutoNotify = false }; Triggers.Add(GameEvent.AfterHealthChanged, trigger); IsEnforced = true; var trigger2 = new AutoNotifyPassiveSkillTrigger( this, (p, e, a) => { Refresh(p); }, TriggerCondition.OwnerIsSource ) { IsAutoNotify = false }; Triggers.Add(GameEvent.PlayerGameStartAction, trigger2); }
void Refresh(Player p) { if (p.Health <= 3) { if (bbTiaoXin == null) { bbTiaoXin = new TiaoXin(); Game.CurrentGame.PlayerAcquireAdditionalSkill(p, bbTiaoXin, HeroTag); } } else { if (bbTiaoXin != null) { Game.CurrentGame.PlayerLoseAdditionalSkill(p, bbTiaoXin); bbTiaoXin = null; } } if (p.Health <= 2) { if (bbPaoXiao == null) { bbPaoXiao = new PaoXiao(); Game.CurrentGame.PlayerAcquireAdditionalSkill(p, bbPaoXiao, HeroTag); } } else { if (bbPaoXiao != null) { Game.CurrentGame.PlayerLoseAdditionalSkill(p, bbPaoXiao); bbPaoXiao = null; } } if (p.Health == 1) { if (bbShenSu == null) { bbShenSu = new ShenSu(); Game.CurrentGame.PlayerAcquireAdditionalSkill(p, bbShenSu, HeroTag); } } else { if (bbShenSu != null) { Game.CurrentGame.PlayerLoseAdditionalSkill(p, bbShenSu); bbShenSu = null; } } }