Beispiel #1
0
 public void Attack(Character target)
 {
     if (target.CurrentHealthPoint < 0)
     {
         return;
     }
     Enemies.Add(target);
     target.Enemies.Add(this);
     foreach (var friend in target.Friends)
     {
         friend.Enemies.Add(this);
     }
     CurrentWorld.IsFighting = true;
     CurrentWorld.SetQueue();
     CurrentWorld.Fight();
     if (CurrentMovePoints < CurrentWeapon.AttackPoint ||
         CurrentWeapon.Range * Math.Sqrt(2) < GetRange(target) ||
         CurrentWeapon.CurrentCapacity <= 0)
     {
         return;
     }
     CurrentWeapon.CurrentCapacity--;
     target.CurrentHealthPoint -= CurrentWeapon.Damage;
     CurrentMovePoints         -= CurrentWeapon.AttackPoint;
     if (IsPlayer && Enemies.Count == 0)
     {
         CurrentWorld.IsFighting = false;
     }
     if (CurrentMovePoints <= 0)
     {
         IsCurrent = false;
     }
     if (target.CurrentHealthPoint > 0)
     {
         return;
     }
     CurrentWorld.Map[target.Position.X, target.Position.Y] = Essence.Terrain;
     Statistics.ExperiencePoint += GetPointsForKill(target);
     CurrentWorld.PlaceItem(target.Inventory, Position);
 }