示例#1
0
 public Castle(string team, int side)
 {
     this.Team   = team;
     this.Side   = side;
     this.Health = 100;
     if (Castle.DefensiveTeams.Contains(this.Team))
     {
         this.Health = this.Health * 1.5;
     }
     this.MaxHealth    = this.Health;
     this.Dead         = false;
     this.DefendEffect = new CollisionEffect();
 }
示例#2
0
        public void Siege(Character opponent)
        {
            if (opponent.Dead)
            {
                return;
            }

            string[] castleAdvantages;
            Game.Advantages.TryGetValue("castle", out castleAdvantages);
            if (castleAdvantages.Contains(opponent.Type))
            {
                this.Health -= opponent.Damage * 1.5;
                opponent.CastleDamageDone += opponent.Damage * 1.5;
                this.DefendEffect          = new CollisionEffect("defend", CollisionResult.Enhanced, "castle");
                opponent.AttackEffect      = new CollisionEffect("attack", CollisionResult.Enhanced, opponent.Type);
                _ = Task.Run(async() =>
                {
                    await Task.Delay(3000);
                    this.DefendEffect = new CollisionEffect();
                });
                if (this.Health <= 0)
                {
                    this.Dead = true;
                }
                return;
            }
            else
            {
                this.Health -= opponent.Damage;
                opponent.CastleDamageDone += opponent.Damage;
                if (this.Health <= 0)
                {
                    this.Dead = true;
                }
                return;
            }
        }