Exemple #1
0
        public DuanChang()
        {
            var trigger = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) => { return a.Source != null; },
                (p, e, a) =>
                {
                    var h = a.Source.Hero;
                    foreach (ISkill sk in new List<ISkill>(a.Source.AdditionalSkills))
                    {
                        Game.CurrentGame.PlayerLoseSkill(a.Source, sk);
                    }

                    SkillSetChangedEventArgs args = new SkillSetChangedEventArgs();
                    args.Source = a.Source;
                    args.IsLosingSkill = true;
                    foreach (var sk in a.Source.Hero.Skills)
                    {
                        sk.Owner = null;
                        args.Skills.Clear();
                        args.Skills.Add(sk);
                        Game.CurrentGame.Emit(GameEvent.PlayerSkillSetChanged, args);
                    }
                    a.Source.Hero = new Hero(h.Name, h.IsMale, h.Allegiance, h.MaxHealth, new List<ISkill>());
                    a.Source[DuanChangStatus] = 1;
                },
                TriggerCondition.OwnerIsTarget
            );

            Triggers.Add(GameEvent.PlayerIsDead, trigger);
            IsEnforced = true;
        }
Exemple #2
0
        public WuJi()
        {
            var trigger1 = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) => { return p[WuJiAwaken] == 0; },
                (p, e, a) => { p[WuJiCount] += (a as DamageEventArgs).Magnitude; },
                TriggerCondition.OwnerIsSource
            ) { IsAutoNotify = false };
            Triggers.Add(GameEvent.AfterDamageCaused, trigger1);

            var trigger2 = new AutoNotifyPassiveSkillTrigger(
                this,
                (p, e, a) => { return p[WuJiCount] >= 3 && p[WuJiAwaken] == 0; },
                (p, e, a) =>
                {
                    var h = a.Source.Hero;
                    List<ISkill> skills = new List<ISkill>();
                    ISkill huxiao = null;
                    foreach (var sk in h.Skills)
                    {
                        if (sk is HuXiao)
                        {
                            sk.Owner = null;
                            huxiao = sk;
                        }
                        else skills.Add(sk);
                    }
                    Trace.Assert(huxiao != null);
                    p[WuJiAwaken]++;
                    p.MaxHealth++;
                    Game.CurrentGame.RecoverHealth(p, p, 1);
                    a.Source.Hero = new Hero(h.Name, h.IsMale, h.Allegiance, h.MaxHealth, skills);
                    SkillSetChangedEventArgs args = new SkillSetChangedEventArgs();
                    args.Source = a.Source;
                    args.Skills.Add(huxiao);
                    args.IsLosingSkill = true;
                    Game.CurrentGame.Emit(GameEvent.PlayerSkillSetChanged, args);
                },
                TriggerCondition.OwnerIsSource
            );
            Triggers.Add(GameEvent.PhaseBeginEvents[TurnPhase.End], trigger2);
            IsAwakening = true;
        }
Exemple #3
0
 public ISkill LoseHeroSkill(string skillName, Hero heroTag)
 {
     Trace.Assert(heroTag != null && heroTag.Owner == this);
     ISkill skill = heroTag.LoseSkill(skillName);
     if (skill != null)
     {
         SkillSetChangedEventArgs arg = new SkillSetChangedEventArgs();
         arg.Source = this;
         arg.IsLosingSkill = true;
         arg.Skills.Add(skill);
         Game.CurrentGame.Emit(GameEvent.PlayerSkillSetChanged, arg);
     }
     return skill;
 }
Exemple #4
0
 public void LoseAllHerosSkills()
 {
     Trace.Assert(Hero != null);
     List<ISkill> skills = new List<ISkill>(Hero.Skills);
     Hero.LoseAllSkills();
     if (Hero2 != null)
     {
         skills.AddRange(Hero2.Skills);
         Hero2.LoseAllSkills();
     }
     if (skills.Count > 0)
     {
         SkillSetChangedEventArgs arg = new SkillSetChangedEventArgs();
         arg.Source = this;
         arg.IsLosingSkill = true;
         arg.Skills = skills;
         Game.CurrentGame.Emit(GameEvent.PlayerSkillSetChanged, arg);
     }
 }
Exemple #5
0
 public void LoseAllHeroSkills(Hero h)
 {
     Trace.Assert(h.Owner == this);
     List<ISkill> skills = new List<ISkill>(h.Skills);
     h.LoseAllSkills();
     if (skills.Count > 0)
     {
         SkillSetChangedEventArgs arg = new SkillSetChangedEventArgs();
         arg.Source = this;
         arg.IsLosingSkill = true;
         arg.Skills = skills;
         Game.CurrentGame.Emit(GameEvent.PlayerSkillSetChanged, arg);
     }
 }
Exemple #6
0
 public void PlayerLoseSkill(Player p, ISkill skill, bool undeletable = false)
 {
     if (!undeletable && !p.AdditionalSkills.Contains(skill)) return;
     p.LoseAdditionalSkill(skill, undeletable);
     SkillSetChangedEventArgs args = new SkillSetChangedEventArgs();
     args.Source = p;
     args.Skills.Add(skill);
     args.IsLosingSkill = true;
     Emit(GameEvent.PlayerSkillSetChanged, args);
     _ResetCards(p);
 }
Exemple #7
0
 public void PlayerAcquireSkill(Player p, ISkill skill, bool undeletable = false)
 {
     if (p.IsDead) return;
     p.AcquireAdditionalSkill(skill, undeletable);
     SkillSetChangedEventArgs args = new SkillSetChangedEventArgs();
     args.Source = p;
     args.Skills.Add(skill);
     args.IsLosingSkill = false;
     Emit(GameEvent.PlayerSkillSetChanged, args);
     _ResetCards(p);
 }