コード例 #1
0
 public void execute()
 {
     if (this.isExecutable())
     {
         int damage = attacker.MeleeWeapon.Damage;
         deffender.Health -= damage;
         if (deffender.isDead)
         {
             LootGenerator lootGen = new LootGenerator();
             lootGen.generateLoot(attacker, deffender);
             deffender.Field.removeCreature();
             attacker.Money += 3;
             AbstractLogger.Current.Log(attacker.MianownikName + " zabił " + deffender.BiernikName);
         }
         else
         {
             if (deffender.Health * 2 < deffender.MaxHealth)
             {
                 deffender.PanicModeCounter = 20;
                 AbstractLogger.Current.Log(attacker.MianownikName + " zaatakował nożem " + deffender.BiernikName + " i zadał mu " + damage + " obrażeń. " + deffender.MianownikName + " ucieka w popłochu");
             }
             else
             {
                 AbstractLogger.Current.Log(attacker.MianownikName + " zaatakował nożem " + deffender.BiernikName + " i zadał mu " + damage + " obrażeń");
             }
         }
         Random r = RandomNumberGenerator.GlobalRandom;
         if (r.Next(100) < attacker.MeleeWeapon.BrokeChance * 100)
         {
             attacker.MeleeWeapon.Damage = (attacker.MeleeWeapon.Damage + 1) / 2;
             AbstractLogger.Current.Log("Twój nóż uległ uszkodzeniu. Daje teraz tylko " + attacker.MeleeWeapon.Damage + " obrażeń");
         }
         attacker.MeleeWeapon.BrokeChance = Math.Min(1, attacker.MeleeWeapon.BrokeChance * 1.09);
     }
 }
コード例 #2
0
		public void execute()
		{
			if(this.isExecutable())
			{
				int damage = attacker.MeleeWeapon.Damage;
				deffender.Health -= damage;
				if (deffender.isDead)
				{
					LootGenerator lootGen = new LootGenerator();
					lootGen.generateLoot(attacker, deffender);
					deffender.Field.removeCreature();
					attacker.Money += 3;
					AbstractLogger.Current.Log(attacker.MianownikName + " zabił " + deffender.BiernikName);
				}
				else
				{
					if (deffender.Health * 2 < deffender.MaxHealth)
					{
						deffender.PanicModeCounter = 20;
						AbstractLogger.Current.Log(attacker.MianownikName + " zaatakował nożem " + deffender.BiernikName + " i zadał mu " + damage + " obrażeń. " + deffender.MianownikName + " ucieka w popłochu");
					}
					else
					{
						AbstractLogger.Current.Log(attacker.MianownikName + " zaatakował nożem " + deffender.BiernikName + " i zadał mu " + damage + " obrażeń");
					}
				}
				Random r = RandomNumberGenerator.GlobalRandom;
				if (r.Next(100) < attacker.MeleeWeapon.BrokeChance * 100)
				{
					attacker.MeleeWeapon.Damage = (attacker.MeleeWeapon.Damage + 1) / 2;
					AbstractLogger.Current.Log("Twój nóż uległ uszkodzeniu. Daje teraz tylko " + attacker.MeleeWeapon.Damage + " obrażeń");
				}
				attacker.MeleeWeapon.BrokeChance = Math.Min(1, attacker.MeleeWeapon.BrokeChance * 1.09);
			}
		}
コード例 #3
0
		public void execute()
		{
			if(this.isExecutable())
			{
				this.thrower.GrenadeWeapon.Ammo -= 1;
				int enemyCount = 0;
				int enemyKilledCount = 0;
				for(int i=-thrower.GrenadeWeapon.Spread; i<thrower.GrenadeWeapon.Spread + 1; i++)
				{
					for (int j = -thrower.GrenadeWeapon.Spread; j < thrower.GrenadeWeapon.Spread + 1; j++)
					{
						if (map.IsWithinBounds(targetField.Y + j, targetField.X + i))
						{
							Field damagedField = map[targetField.Y + j, targetField.X + i];
							if (i == 0 && j == 0 && damagedField.GetType() == typeof(Wall))
							{
								map[targetField.Y + j, targetField.X + i] = new Floor(damagedField.X, damagedField.Y);
							}

							if (damagedField.Creature != null)
							{
								damagedField.Creature.Health -= this.thrower.GrenadeWeapon.Damage;
								if (damagedField.Creature.isDead)
								{
									++enemyKilledCount;
									thrower.Money += 3;
									LootGenerator lootGen = new LootGenerator();
									lootGen.generateLoot(thrower, damagedField.Creature);
									damagedField.Creature.Field.removeCreature();
								}
								else
								{
									++enemyCount;
									if (damagedField.Creature.Health * 2 < damagedField.Creature.MaxHealth)
									{
										damagedField.Creature.PanicModeCounter = 20;
									}
								}
							}
						}
					}
				}
				AbstractLogger.Current.Log(thrower.MianownikName + " rzucił granatem zabijając " + enemyKilledCount + " i raniąc " + enemyCount + " osób.");
			}
		}
コード例 #4
0
        public void execute()
        {
            if (this.isExecutable())
            {
                this.thrower.GrenadeWeapon.Ammo -= 1;
                int enemyCount       = 0;
                int enemyKilledCount = 0;
                for (int i = -thrower.GrenadeWeapon.Spread; i < thrower.GrenadeWeapon.Spread + 1; i++)
                {
                    for (int j = -thrower.GrenadeWeapon.Spread; j < thrower.GrenadeWeapon.Spread + 1; j++)
                    {
                        if (map.IsWithinBounds(targetField.Y + j, targetField.X + i))
                        {
                            Field damagedField = map[targetField.Y + j, targetField.X + i];
                            if (i == 0 && j == 0 && damagedField.GetType() == typeof(Wall))
                            {
                                map[targetField.Y + j, targetField.X + i] = new Floor(damagedField.X, damagedField.Y);
                            }

                            if (damagedField.Creature != null)
                            {
                                damagedField.Creature.Health -= this.thrower.GrenadeWeapon.Damage;
                                if (damagedField.Creature.isDead)
                                {
                                    ++enemyKilledCount;
                                    thrower.Money += 3;
                                    LootGenerator lootGen = new LootGenerator();
                                    lootGen.generateLoot(thrower, damagedField.Creature);
                                    damagedField.Creature.Field.removeCreature();
                                }
                                else
                                {
                                    ++enemyCount;
                                    if (damagedField.Creature.Health * 2 < damagedField.Creature.MaxHealth)
                                    {
                                        damagedField.Creature.PanicModeCounter = 20;
                                    }
                                }
                            }
                        }
                    }
                }
                AbstractLogger.Current.Log(thrower.MianownikName + " rzucił granatem zabijając " + enemyKilledCount + " i raniąc " + enemyCount + " osób.");
            }
        }
コード例 #5
0
 public void execute()
 {
     if (CanShoot(map, attacker, deffender))
     {
         attacker.RangedWeapon.Ammo -= 1;
         if (randomNumberGenerator.generateNumber() <= attacker.RangedWeapon.Chance)
         {
             int damage = attacker.RangedWeapon.Damage;
             deffender.Health -= damage;
             if (deffender.isDead)
             {
                 LootGenerator lootGen = new LootGenerator();
                 attacker.Money += 3;
                 lootGen.generateLoot(attacker, deffender);
                 deffender.Field.removeCreature();
                 AbstractLogger.Current.Log(attacker.MianownikName + " zabił " + deffender.BiernikName);
             }
             else
             {
                 if (deffender.Health * 2 < deffender.MaxHealth)
                 {
                     deffender.PanicModeCounter = 20;
                     AbstractLogger.Current.Log(attacker.MianownikName + " strzelił " + deffender.BiernikName + " i zadał mu " + damage + " obrażeń. " + deffender.MianownikName + " ucieka w popłochu");
                 }
                 else
                 {
                     AbstractLogger.Current.Log(attacker.MianownikName + " strzelił do " + deffender.BiernikName + " i zadał mu " + damage + " obrażeń");
                 }
             }
         }
         else
         {
             AbstractLogger.Current.Log(attacker.MianownikName + " strzelił do " + deffender.BiernikName + " ale nie trafił.");
         }
     }
 }
コード例 #6
0
		public void execute()
		{
			if (CanShoot(map, attacker, deffender))
			{
				attacker.RangedWeapon.Ammo -= 1;
				if (randomNumberGenerator.generateNumber() <= attacker.RangedWeapon.Chance)
				{
					int damage = attacker.RangedWeapon.Damage;
					deffender.Health -= damage;
					if (deffender.isDead)
					{
						LootGenerator lootGen = new LootGenerator();
						attacker.Money += 3;
						lootGen.generateLoot(attacker, deffender);
						deffender.Field.removeCreature();
						AbstractLogger.Current.Log(attacker.MianownikName + " zabił " + deffender.BiernikName);
					}
					else
					{
						if (deffender.Health * 2 < deffender.MaxHealth)
						{
							deffender.PanicModeCounter = 20;
							AbstractLogger.Current.Log(attacker.MianownikName + " strzelił " + deffender.BiernikName + " i zadał mu " + damage + " obrażeń. " + deffender.MianownikName + " ucieka w popłochu");
						}
						else
						{
							AbstractLogger.Current.Log(attacker.MianownikName + " strzelił do " + deffender.BiernikName + " i zadał mu " + damage + " obrażeń");
						}
					}
				}
				else
				{
					AbstractLogger.Current.Log(attacker.MianownikName + " strzelił do " + deffender.BiernikName + " ale nie trafił.");
				}
			}
		}