コード例 #1
0
ファイル: War.java プロジェクト: adegie/Towny
 public void add(Town town) {
   TownyMessaging.sendTownMessage(town, TownySettings.getJoinWarMsg(town));
   townScores.put(town, 0);
   warringTowns.add(town);
   for (TownBlock townBlock : town.getTownBlocks())
     if (town.isHomeBlock(townBlock))
       warZone.put(townBlock.getWorldCoord(), TownySettings.getWarzoneHomeBlockHealth());
     else warZone.put(townBlock.getWorldCoord(), TownySettings.getWarzoneTownBlockHealth());
 }
コード例 #2
0
ファイル: War.java プロジェクト: adegie/Towny
 public void remove(Town attacker, TownBlock townBlock) throws NotRegisteredException {
   townScored(attacker, TownySettings.getWarPointsForTownBlock());
   townBlock.getTown().addBonusBlocks(-1);
   attacker.addBonusBlocks(1);
   try {
     if (!townBlock
         .getTown()
         .payTo(TownySettings.getWartimeTownBlockLossPrice(), attacker, "War - TownBlock Loss")) {
       remove(townBlock.getTown());
       TownyMessaging.sendTownMessage(
           townBlock.getTown(), "Your town ran out of funds to support yourself in war.");
     } else
       TownyMessaging.sendTownMessage(
           townBlock.getTown(),
           "Your town lost "
               + TownySettings.getWartimeTownBlockLossPrice()
               + " "
               + TownyEconomyObject.getEconomyCurrency()
               + ".");
   } catch (EconomyException e) {
   }
   if (townBlock.getTown().isHomeBlock(townBlock)) remove(townBlock.getTown());
   else remove(townBlock.getWorldCoord());
   TownyUniverse.getDataSource().saveTown(townBlock.getTown());
   TownyUniverse.getDataSource().saveTown(attacker);
 }
コード例 #3
0
ファイル: War.java プロジェクト: adegie/Towny
 public void damage(Town attacker, TownBlock townBlock) throws NotRegisteredException {
   WorldCoord worldCoord = townBlock.getWorldCoord();
   int hp = warZone.get(worldCoord) - 1;
   if (hp > 0) {
     warZone.put(worldCoord, hp);
     // if (hp % 10 == 0) {
     universe.sendMessageTo(
         townBlock.getTown(),
         Colors.Gray
             + "["
             + townBlock.getTown().getName()
             + "]("
             + townBlock.getCoord().toString()
             + ") HP: "
             + hp,
         "");
     universe.sendMessageTo(
         attacker,
         Colors.Gray
             + "["
             + townBlock.getTown().getName()
             + "]("
             + townBlock.getCoord().toString()
             + ") HP: "
             + hp,
         "");
     // }
   } else remove(attacker, townBlock);
 }
コード例 #4
0
ファイル: War.java プロジェクト: adegie/Towny
 public void remove(Town town) {
   for (TownBlock townBlock : town.getTownBlocks()) remove(townBlock.getWorldCoord());
   warringTowns.remove(town);
   try {
     if (!townsLeft(town.getNation())) eliminate(town.getNation());
   } catch (NotRegisteredException e) {
   }
 }
コード例 #5
0
ファイル: War.java プロジェクト: adegie/Towny
  public void remove(Town attacker, Town town) throws NotRegisteredException {
    townScored(attacker, TownySettings.getWarPointsForTown());

    for (TownBlock townBlock : town.getTownBlocks()) remove(townBlock.getWorldCoord());
    warringTowns.remove(town);
    try {
      if (!townsLeft(town.getNation())) eliminate(town.getNation());
    } catch (NotRegisteredException e) {
    }
  }
コード例 #6
0
ファイル: War.java プロジェクト: adegie/Towny
 public int countActiveWarBlocks(Town town) {
   int n = 0;
   for (TownBlock townBlock : town.getTownBlocks())
     if (warZone.containsKey(townBlock.getWorldCoord())) n++;
   return n;
 }
コード例 #7
0
ファイル: War.java プロジェクト: adegie/Towny
 public void remove(TownBlock townBlock) throws NotRegisteredException {
   if (townBlock.getTown().isHomeBlock(townBlock)) remove(townBlock.getTown());
   else remove(townBlock.getWorldCoord());
 }