Add config option for creeper turn explosion
This commit is contained in:
parent
f5f7ce52cc
commit
befc7cf611
9 changed files with 40 additions and 12 deletions
|
@ -1,5 +1,10 @@
|
|||
# Upcoming changes
|
||||
|
||||
# Version 1.15
|
||||
|
||||
Add server-side config option that determines on what turn a Creeper will
|
||||
explode in battle.
|
||||
|
||||
# Version 1.14
|
||||
|
||||
Implemented support for Creepers in battle.
|
||||
|
|
|
@ -14,7 +14,7 @@ apply plugin: 'eclipse'
|
|||
//apply plugin: 'maven-publish'
|
||||
apply plugin: 'com.github.johnrengelman.shadow'
|
||||
|
||||
version = "1.14"
|
||||
version = "1.15"
|
||||
group = "com.burnedkirby.TurnBasedMinecraft"
|
||||
archivesBaseName = "TurnBasedMinecraft"
|
||||
|
||||
|
|
|
@ -830,7 +830,7 @@ public class Battle
|
|||
if(!(c.entity instanceof PlayerEntity) && c.decision == Decision.UNDECIDED && c.entityInfo != null)
|
||||
{
|
||||
if(c.entity instanceof CreeperEntity) {
|
||||
if(c.creeperTurns++ < 2) {
|
||||
if(c.creeperTurns++ < TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
|
||||
c.decision = Decision.CREEPER_WAIT;
|
||||
} else {
|
||||
c.decision = Decision.CREEPER_EXPLODE;
|
||||
|
@ -857,7 +857,7 @@ public class Battle
|
|||
if(!(c.entity instanceof PlayerEntity) && c.decision == Decision.UNDECIDED && c.entityInfo != null)
|
||||
{
|
||||
if(c.entity instanceof CreeperEntity) {
|
||||
if(c.creeperTurns++ < 2) {
|
||||
if(c.creeperTurns++ < TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
|
||||
c.decision = Decision.CREEPER_WAIT;
|
||||
} else {
|
||||
c.decision = Decision.CREEPER_EXPLODE;
|
||||
|
@ -1348,7 +1348,7 @@ public class Battle
|
|||
break;
|
||||
case CREEPER_WAIT:
|
||||
debugLog += " creeper wait";
|
||||
if(next.creeperTurns < 2) {
|
||||
if(next.creeperTurns < TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
|
||||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.CREEPER_WAIT, next.entity.getEntityId(), 0, 0);
|
||||
} else {
|
||||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.CREEPER_WAIT_FINAL, next.entity.getEntityId(), 0, 0);
|
||||
|
@ -1493,7 +1493,7 @@ public class Battle
|
|||
private void defuseCreepers() {
|
||||
for(Combatant c : sideA.values()) {
|
||||
if(c.entity instanceof CreeperEntity) {
|
||||
if(c.creeperTurns <= 2) {
|
||||
if(c.creeperTurns <= TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
|
||||
((CreeperEntity)c.entity).setCreeperState(-10);
|
||||
} else {
|
||||
((CreeperEntity)c.entity).setCreeperState(1000000);
|
||||
|
@ -1502,7 +1502,7 @@ public class Battle
|
|||
}
|
||||
for(Combatant c : sideB.values()) {
|
||||
if(c.entity instanceof CreeperEntity) {
|
||||
if(c.creeperTurns <= 2) {
|
||||
if(c.creeperTurns <= TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
|
||||
((CreeperEntity)c.entity).setCreeperState(-10);
|
||||
} else {
|
||||
((CreeperEntity) c.entity).setCreeperState(1000000);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class Combatant
|
|||
decision = Battle.Decision.UNDECIDED;
|
||||
recalcSpeedOnCompare = false;
|
||||
remainingDefenses = 0;
|
||||
creeperTurns = 0;
|
||||
creeperTurns = 1;
|
||||
}
|
||||
|
||||
public Combatant(Entity e, EntityInfo entityInfo)
|
||||
|
@ -42,7 +42,7 @@ public class Combatant
|
|||
this.entityInfo = entityInfo;
|
||||
recalcSpeedOnCompare = false;
|
||||
remainingDefenses = 0;
|
||||
creeperTurns = 0;
|
||||
creeperTurns = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,6 +45,7 @@ public class Config
|
|||
private boolean oldBattleBehaviorEnabled = false;
|
||||
private int leaveBattleCooldownSeconds = 5;
|
||||
private int aggroStartBattleDistance = 8;
|
||||
private int creeperExplodeTurn = 5;
|
||||
|
||||
public Config(Logger logger)
|
||||
{
|
||||
|
@ -236,6 +237,23 @@ public class Config
|
|||
logTOMLInvalidValue("server_config.aggro_start_battle_max_distance", "8");
|
||||
}
|
||||
|
||||
try {
|
||||
OptionalInt creeper_explode_turn = conf.getOptionalInt("server_config.creeper_explode_turn");
|
||||
if(creeper_explode_turn.isPresent()) {
|
||||
this.creeperExplodeTurn = creeper_explode_turn.getAsInt();
|
||||
if(this.creeperExplodeTurn < 1) {
|
||||
logClampedValue("server_config.creeper_explode_turn", Integer.toString(this.creeperExplodeTurn), "1");
|
||||
this.creeperExplodeTurn = 1;
|
||||
}
|
||||
} else {
|
||||
this.creeperExplodeTurn = 5;
|
||||
logNotFound("server_config.creeper_explode_turn", "5");
|
||||
}
|
||||
} catch(ClassCastException e) {
|
||||
this.creeperExplodeTurn = 5;
|
||||
logTOMLInvalidValue("server_config.creeper_explode_turn", "5");
|
||||
}
|
||||
|
||||
try {
|
||||
Boolean old_battle_behavior = conf.get("server_config.old_battle_behavior");
|
||||
if(old_battle_behavior != null) {
|
||||
|
@ -1137,4 +1155,6 @@ public class Config
|
|||
{
|
||||
return aggroStartBattleDistance;
|
||||
}
|
||||
|
||||
public int getCreeperExplodeTurn() { return creeperExplodeTurn; }
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class TurnBasedMinecraftMod
|
|||
{
|
||||
public static final String MODID = "com_burnedkirby_turnbasedminecraft";
|
||||
public static final String NAME = "Turn Based Minecraft Mod";
|
||||
public static final String VERSION = "1.14";
|
||||
public static final String VERSION = "1.15";
|
||||
public static final String CONFIG_FILENAME = "TBM_Config.toml";
|
||||
public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml";
|
||||
public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/";
|
||||
|
|
|
@ -15,7 +15,7 @@ license="MIT"
|
|||
# The modid of the mod
|
||||
modId="com_burnedkirby_turnbasedminecraft" #mandatory
|
||||
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||
version="1.14" #mandatory
|
||||
version="1.15" #mandatory
|
||||
# A display name for the mod
|
||||
displayName="TurnBasedMinecraftMod" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification <here>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Please do not change this option, the mod uses this to keep track of what new
|
||||
# changes to add to the config.
|
||||
version = 4
|
||||
version = 5
|
||||
do_not_overwrite = false
|
||||
|
||||
[client_config]
|
||||
|
@ -69,6 +69,9 @@ minimum_hit_percentage = 4
|
|||
# Minimum 5, maximum 60.
|
||||
battle_turn_time_seconds = 15
|
||||
|
||||
# On what turn a Creeper will explode in battle
|
||||
creeper_explode_turn = 5
|
||||
|
||||
|
||||
# Each "server_config.entity" entry uses the following options:
|
||||
# name: full class name of the entity, cannot also have option "custom_name"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"modid": "com_burnedkirby_turnbasedminecraft",
|
||||
"name": "Turn Based Minecraft",
|
||||
"description": "Changes battles to be turn-based.",
|
||||
"version": "1.14",
|
||||
"version": "1.15",
|
||||
"mcversion": "1.16.3",
|
||||
"url": "",
|
||||
"updateUrl": "",
|
||||
|
|
Loading…
Reference in a new issue