mirror of
https://github.com/taoneill/war.git
synced 2024-11-13 05:54:31 +01:00
Closes gh-8. Monument Heal Rate is now configurable (monumentheal:X), also the Monument Heal Message now shows by how many hearts the player was healed
This commit is contained in:
parent
d84ed6e410
commit
568833b1bf
@ -67,6 +67,7 @@ public class War extends JavaPlugin {
|
||||
private boolean defaultAutoAssignOnly = false;
|
||||
private int defaultTeamCap = 7;
|
||||
private int defaultScoreCap = 10;
|
||||
private int defaultMonumentHeal = 5; //SY
|
||||
private boolean defaultBlockHeads = true;
|
||||
private boolean defaultDropLootOnDeath = false;
|
||||
private String defaultSpawnStyle = TeamSpawnStyles.BIG;
|
||||
@ -1053,6 +1054,9 @@ public class War extends JavaPlugin {
|
||||
if(namedParams.containsKey("lifepool")){
|
||||
warzone.setLifePool(Integer.parseInt(namedParams.get("lifepool")));
|
||||
}
|
||||
if(namedParams.containsKey("monumentheal")){ //SY
|
||||
warzone.setMonumentHeal(Integer.parseInt(namedParams.get("monumentheal")));
|
||||
}
|
||||
if(namedParams.containsKey("teamsize")){
|
||||
warzone.setTeamCap(Integer.parseInt(namedParams.get("teamsize")));
|
||||
}
|
||||
@ -1127,6 +1131,9 @@ public class War extends JavaPlugin {
|
||||
if(namedParams.containsKey("lifepool")){
|
||||
setDefaultLifepool(Integer.parseInt(namedParams.get("lifepool")));
|
||||
}
|
||||
if(namedParams.containsKey("monumentheal")){ //SY
|
||||
setDefaultMonumentHeal(Integer.parseInt(namedParams.get("monumentheal")));
|
||||
}
|
||||
if(namedParams.containsKey("teamsize")){
|
||||
setDefaultTeamCap(Integer.parseInt(namedParams.get("teamsize")));
|
||||
}
|
||||
@ -1316,6 +1323,14 @@ public class War extends JavaPlugin {
|
||||
return defaultLifepool;
|
||||
}
|
||||
|
||||
public void setDefaultMonumentHeal(int defaultMonumentHeal) { //SY
|
||||
this.defaultMonumentHeal = defaultMonumentHeal;
|
||||
}
|
||||
|
||||
public int getDefaultMonumentHeal() { //SY
|
||||
return defaultMonumentHeal;
|
||||
}
|
||||
|
||||
public void setDefaultFriendlyFire(boolean defaultFriendlyFire) {
|
||||
this.defaultFriendlyFire = defaultFriendlyFire;
|
||||
}
|
||||
|
@ -340,17 +340,26 @@ public class WarPlayerListener extends PlayerListener {
|
||||
return;
|
||||
}
|
||||
|
||||
// Monuments
|
||||
// Monuments //SY
|
||||
if(team != null
|
||||
&& playerWarzone.nearAnyOwnedMonument(playerLoc, team)
|
||||
&& player.getHealth() < 20
|
||||
&& player.getHealth() > 0 // don't heal the dead
|
||||
&& random.nextInt(77) == 3 ) { // one chance out of many of getting healed
|
||||
int currentHp = player.getHealth();
|
||||
int newHp = currentHp + 5;
|
||||
int newHp = currentHp + locZone.getMonumentHeal();
|
||||
if(newHp > 20) newHp = 20;
|
||||
player.setHealth(newHp);
|
||||
war.msg(player, "Your dance pleases the monument's voodoo. You gain health!");
|
||||
String isS = "s"; // no 's' in 'hearts' when it's just one heart
|
||||
if (newHp-currentHp==2) isS="";
|
||||
String heartNum = ""; // since (newHp-currentHp)/2 won't give the right amount
|
||||
if (newHp-currentHp==2)
|
||||
heartNum="1 ";
|
||||
else if (newHp-currentHp%2==0) // for some reason
|
||||
heartNum=((newHp-currentHp)/2)+" ";
|
||||
else
|
||||
heartNum=((newHp-currentHp-1)/2)+".5 ";
|
||||
war.msg(player, "Your dance pleases the monument's voodoo. You gain "+heartNum+"heart"+isS+"!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,9 @@ public class WarMapper {
|
||||
// defaultLifePool
|
||||
war.setDefaultLifepool(warConfig.getInt("defaultLifePool"));
|
||||
|
||||
// defaultMonumentHeal //SY
|
||||
war.setDefaultLifepool(warConfig.getInt("defaultMonumentHeal"));
|
||||
|
||||
// defaultFriendlyFire
|
||||
war.setDefaultFriendlyFire(warConfig.getBoolean("defaultFriendlyFire"));
|
||||
|
||||
@ -183,6 +186,9 @@ public class WarMapper {
|
||||
// defaultLifepool
|
||||
warConfig.setInt("defaultLifePool", war.getDefaultLifepool());
|
||||
|
||||
// defaultMonumentHeal //SY
|
||||
warConfig.setInt("defaultMonumentHeal", war.getDefaultMonumentHeal());
|
||||
|
||||
// defaultFriendlyFire
|
||||
warConfig.setBoolean("defaultFriendlyFire", war.getDefaultFriendlyFire());
|
||||
|
||||
|
@ -170,6 +170,9 @@ public class WarzoneMapper {
|
||||
// life pool
|
||||
warzone.setLifePool(warzoneConfig.getInt("lifePool"));
|
||||
|
||||
// monument heal //SY
|
||||
warzone.setMonumentHeal(warzoneConfig.getInt("monumentHeal"));
|
||||
|
||||
// drawZoneOutline
|
||||
warzone.setDrawZoneOutline(warzoneConfig.getBoolean("drawZoneOutline"));
|
||||
|
||||
@ -388,6 +391,9 @@ public class WarzoneMapper {
|
||||
// life pool
|
||||
warzoneConfig.setInt("lifePool", warzone.getLifePool());
|
||||
|
||||
// monument heal //SY
|
||||
warzoneConfig.setInt("monumentHeal", warzone.getMonumentHeal());
|
||||
|
||||
// drawZoneOutline
|
||||
warzoneConfig.setBoolean("drawZoneOutline", warzone.isDrawZoneOutline());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user