Beispiel #1
0
 public void attack(Level mapLevel)
 {
     if (mapLevel.CharacterEntities.FindEntity(MouseController.MouseGridPosition()) != this)
     {
         GameCharacter testEnemy = (GameCharacter)mapLevel.CharacterEntities.FindEntity(MouseController.MouseGridPosition());
         if (testEnemy != null)
         {
             int      weaponRange1  = currentlyEquippedItems.getPrimaryWeaponRange() + rangeBoost;
             int      weaponRange2  = currentlyEquippedItems.getAuxilaryWeaponRange() + rangeBoost;
             IntVec[] weaponHitbox1 = AStar.getPossiblePositionsFrom(mapLevel, mapLevel.CharacterEntities.FindPosition(this), weaponRange1, true, true);
             IntVec[] weaponHitbox2 = AStar.getPossiblePositionsFrom(mapLevel, mapLevel.CharacterEntities.FindPosition(this), weaponRange2, true, true);
             damageEnemyIfInRange(weaponHitbox1, mapLevel, testEnemy, currentlyEquippedItems.getPrimaryWeapon(), true);
             damageEnemyIfInRange(weaponHitbox2, mapLevel, testEnemy, currentlyEquippedItems.getAuxilaryWeapon(), false);
         }
     }
 }
Beispiel #2
0
        public void attack(Level mapLevel)
        {
            if (mapLevel.CharacterEntities.FindEntity(MouseController.MouseGridPosition()) != this)
            {
                GameCharacter testEnemy = (GameCharacter)mapLevel.CharacterEntities.FindEntity(MouseController.MouseGridPosition());
                if (testEnemy != null)
                {
                    int      weaponRange1  = currentlyEquippedItems.getPrimaryWeaponRange() + rangeBoost;
                    int      weaponRange2  = currentlyEquippedItems.getAuxilaryWeaponRange() + rangeBoost;
                    IntVec[] weaponHitbox1 = AStar.getPossiblePositionsFrom(mapLevel, mapLevel.CharacterEntities.FindPosition(this), weaponRange1, true, true);
                    IntVec[] weaponHitbox2 = AStar.getPossiblePositionsFrom(mapLevel, mapLevel.CharacterEntities.FindPosition(this), weaponRange2, true, true);
                    damageEnemyIfInRange(weaponHitbox1, mapLevel, testEnemy, currentlyEquippedItems.getPrimaryWeapon(), true);
                    damageEnemyIfInRange(weaponHitbox2, mapLevel, testEnemy, currentlyEquippedItems.getAuxilaryWeapon(), false);
                    if (Element != null)
                    {
                        for (int i = 0; i < Element.Count; i++)
                        {
                            switch (Element[i])
                            {
                            case ElementAttributes.Fire:
                                testEnemy.DealElementalDamage(Element[i], 5, level / 2);
                                break;

                            case ElementAttributes.Ice:
                                testEnemy.DealElementalDamage(Element[i], 3);
                                break;

                            case ElementAttributes.Lighting:
                                testEnemy.DealElementalDamage(Element[i], 1, (level));
                                break;

                            case ElementAttributes.Arcane:
                                testEnemy.DealElementalDamage(Element[i], 7, level / 2);
                                break;
                            }
                        }
                    }
                }
            }
        }