Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Siege rework #1

Merged
merged 21 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a818306
effortless building fix
Supernoobv Jul 6, 2024
6264c1b
forgot mixins json (woops)
Supernoobv Jul 6, 2024
269e8a6
Make kills valid within 3x3 chunk area around siege camp (Untested)
MisterNorwood Jul 10, 2024
cbb291a
Siege Cooldown is now configurable hopefully
ReclipseTheOne Jul 10, 2024
658f18a
prepare for adding new cooldowns
MisterNorwood Jul 13, 2024
699e428
untied flags from global timer, flags use own cooldown (untested)
MisterNorwood Jul 13, 2024
0a9eab0
fix missmapped settings
MisterNorwood Jul 13, 2024
0219821
Another cooldown based commit <3
ReclipseTheOne Jul 13, 2024
500ee0a
Merge branch 'master' of https://github.com/ReclipseTheOne/WarForge-R…
Supernoobv Jul 15, 2024
33024a4
Merge branch 'siege-rework' of https://github.com/ReclipseTheOne/WarF…
Supernoobv Jul 15, 2024
a729ffe
reclipse genius maths at work
Supernoobv Jul 15, 2024
7ea1e1b
Siege block *should* be breakable now, testing needed
ReclipseTheOne Jul 20, 2024
8b69f03
add claim dimension whitelist
MisterNorwood Jul 20, 2024
3e28b6f
Adds forcing siege to end, destroying siege block automatically, with…
EightXOR8 Jul 26, 2024
35a1093
Remove logging and rename username for run client back to default.
EightXOR8 Jul 26, 2024
ac4db71
Adds handling for sieges ended properly and changes some notification…
EightXOR8 Jul 26, 2024
61f313a
Implement Anit-SiegeLog
MisterNorwood Jul 27, 2024
e160f77
Fix implementation of Anit-SiegeLog
MisterNorwood Jul 27, 2024
c69712c
add isEmpty
MisterNorwood Jul 27, 2024
2d46e12
Adds grace period for chunks won (including defended) in a siege, den…
EightXOR8 Jul 27, 2024
55c645f
Notify attackers when siege zone has been abandoned for ~1/16th the t…
EightXOR8 Jul 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ show_testing_output = false

# Mod Information
# HIGHLY RECOMMEND complying with SemVer for mod_version: https://semver.org/
mod_version = 1.0.0
root_package = com.example
mod_id = modid
mod_name = Mod Name
mod_version = 1.2.1
root_package = com.flansmod.warforge
mod_id = warforge
mod_name = Warforge Factions

# Mod Metadata (Optional)
mod_description =
Expand Down Expand Up @@ -97,7 +97,7 @@ access_transformer_locations = ${mod_id}_at.cfg
# Powerful tool to do runtime description changes of classes
# Wiki: https://github.com/SpongePowered/Mixin/wiki + https://github.com/CleanroomMC/MixinBooter/ + https://cleanroommc.com/wiki/forge-mod-development/mixin/preface
# Only use mixins once you understand the underlying structure
use_mixins = false
use_mixins = true
mixin_booter_version = 9.1
# A configuration defines a mixin set, and you may have as many mixin sets as you require for your application.
# Each config can only have one and only one package root.
Expand Down
2 changes: 2 additions & 0 deletions gradle/scripts/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,6 @@ dependencies {
// implementation ('com.google.code.gson:gson:2.8.6') {
// transitive = false
// }

implementation rfg.deobf("curse.maven:effortlessbuilding-302113:2847346")
}
23 changes: 23 additions & 0 deletions src/main/java/com/flansmod/warforge/api/ObjectIntPair.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.flansmod.warforge.api;

public class ObjectIntPair<T> {
private T left;
private int right;

public ObjectIntPair() {
left = null;
right = 0;
}

public ObjectIntPair(T left, int right) {
this.left = left;
this.right = right;
}

public void setLeft(T left) { this.left = left; }
public T getLeft() { return left; }

public void setRight(int right) { this.right = right; }
public int getRight() { return right; }

}
9 changes: 3 additions & 6 deletions src/main/java/com/flansmod/warforge/client/GuiSiegeCamp.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,22 @@
import java.util.UUID;

import com.flansmod.warforge.common.DimBlockPos;
import com.flansmod.warforge.common.DimChunkPos;
import com.flansmod.warforge.common.WarForgeMod;
import com.flansmod.warforge.common.blocks.IClaim;
import com.flansmod.warforge.common.blocks.TileEntityCitadel;
import com.flansmod.warforge.common.blocks.TileEntitySiegeCamp;
import com.flansmod.warforge.common.network.PacketCreateFaction;
import com.flansmod.warforge.common.network.PacketPlaceFlag;
import com.flansmod.warforge.common.network.PacketStartSiege;
import com.flansmod.warforge.common.network.SiegeCampAttackInfo;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;

/*
Controls gui to start raid, not on screen siege progression
*/
public class GuiSiegeCamp extends GuiScreen
{
private static final ResourceLocation texture = new ResourceLocation(WarForgeMod.MODID, "gui/siegemenu.png");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ public void UpdateServer()
}

@Nonnull
public ProtectionConfig GetProtections(UUID playerID, DimBlockPos pos)
public static ProtectionConfig GetProtections(UUID playerID, DimBlockPos pos)
{
return GetProtections(playerID, pos.ToChunkPos());
}

// It is generally expected that you are asking about a loaded chunk, not that that should matter
@Nonnull
public ProtectionConfig GetProtections(UUID playerID, DimChunkPos pos)
public static ProtectionConfig GetProtections(UUID playerID, DimChunkPos pos)
{
UUID factionID = WarForgeMod.FACTIONS.GetClaim(pos);
if(factionID.equals(FactionStorage.SAFE_ZONE_ID))
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/com/flansmod/warforge/common/WarForgeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class WarForgeConfig

// Claims
public static final String CATEGORY_CLAIMS = "Claims";
public static int[] CLAIM_DIM_WHITELIST = new int[]{0};
public static int CLAIM_STRENGTH_CITADEL = 15;
public static int CLAIM_STRENGTH_REINFORCED = 10;
public static int CLAIM_STRENGTH_BASIC = 5;
Expand All @@ -103,6 +104,11 @@ public class WarForgeConfig

public static int ATTACK_STRENGTH_SIEGE_CAMP = 1;
public static float LEECH_PROPORTION_SIEGE_CAMP = 0.25f;
public static int MAX_SIEGES = 3;
public static int ATTACKER_DESERTION_TIMER = 180; // in seconds
public static int ATTACKER_CONQUERED_CHUNK_PERIOD = 3600000; // in ms (one hour by default)
public static int DEFENDER_CONQUERED_CHUNK_PERIOD = 7200000; // in ms (2h by default)
public static int COMBAT_LOG_THRESHOLD = 10000; // in ms (10s by default)

// Yields
public static final String CATEGORY_YIELDS = "Yields";
Expand Down Expand Up @@ -137,6 +143,8 @@ public class WarForgeConfig
public static int SIEGE_SWING_PER_ATTACKER_FLAG = 1;
public static int SIEGE_DIFFICULTY_PER_DEFENDER_FLAG = 3;
public static boolean SIEGE_CAPTURE = true;
public static float SIEGE_COOLDOWN_FAIL = 30f; // In minutes
public static float FLAG_COOLDOWN = 1f; // In minutes

// Notoriety
public static final String CATEGORY_NOTORIETY = "Notoriety";
Expand Down Expand Up @@ -399,6 +407,7 @@ public static void SyncConfig(File suggestedFile)


// Claim Settings
CLAIM_DIM_WHITELIST = configFile.get(CATEGORY_CLAIMS, "Claim Dimension Whitelist", CLAIM_DIM_WHITELIST, "In which dimensions should player be able to claim chunks").getIntList();
CLAIM_STRENGTH_CITADEL = configFile.getInt("Citadel Claim Strength", CATEGORY_CLAIMS, CLAIM_STRENGTH_CITADEL, 1, 1024, "The strength of citadel claims");
CLAIM_STRENGTH_REINFORCED = configFile.getInt("Reinforced Claim Strength", CATEGORY_CLAIMS, CLAIM_STRENGTH_REINFORCED, 1, 1024, "The strength of reinforced claims");
CLAIM_STRENGTH_BASIC = configFile.getInt("Basic Claim Strength", CATEGORY_CLAIMS, CLAIM_STRENGTH_BASIC, 1, 1024, "The strength of basic claims");
Expand All @@ -410,6 +419,11 @@ public static void SyncConfig(File suggestedFile)
// Siege Camp Settings
ATTACK_STRENGTH_SIEGE_CAMP = configFile.getInt("Siege Camp Attack Strength", CATEGORY_SIEGES, ATTACK_STRENGTH_SIEGE_CAMP, 1, 1024, "How much attack pressure a siege camp exerts on adjacent enemy claims");
LEECH_PROPORTION_SIEGE_CAMP = configFile.getFloat("Siege Camp Leech Proportion", CATEGORY_SIEGES, LEECH_PROPORTION_SIEGE_CAMP, 0f, 1f, "What proportion of a claim's yields are leeched when a siege camp is set to leech mode");
MAX_SIEGES = configFile.getInt("Siege Camp Max Count Per Faction", CATEGORY_SIEGES, MAX_SIEGES, 1, 1000, "How many sieges each faction is allowed to have, with any additional siege camps being unable to be placed by members");
ATTACKER_DESERTION_TIMER = configFile.getInt("Attacker Desertion Timer [s]", CATEGORY_SIEGES, ATTACKER_DESERTION_TIMER, 0, Integer.MAX_VALUE, "The number of seconds a siege can idle with no attackers in it before any action occurs. Setting to 0 results in checks being run every tick.");
ATTACKER_CONQUERED_CHUNK_PERIOD = configFile.getInt("Attacker Conquered Chunk Grace Period [ms]", CATEGORY_SIEGES, ATTACKER_CONQUERED_CHUNK_PERIOD, 0, Integer.MAX_VALUE, "The number of milliseconds to permit placement within a chunk only by the faction who last won a siege on it. Setting to 0 results in no grace period.");
DEFENDER_CONQUERED_CHUNK_PERIOD = configFile.getInt("Defender Conquered Chunk Grace Period [ms]", CATEGORY_SIEGES, DEFENDER_CONQUERED_CHUNK_PERIOD, 0, Integer.MAX_VALUE, "The number of milliseconds to deny sieging or claiming in previously sieged chunk in which the siege was won by the defenders. Setting to 0 results in no grace period.");
COMBAT_LOG_THRESHOLD = configFile.getInt("Time to Combat Log Action [ms]", CATEGORY_SIEGES, COMBAT_LOG_THRESHOLD, 0, Integer.MAX_VALUE, "The number of milliseconds before enforcement action is taken when a player leaves during a siege on any of their claims.");

// Siege swing parameters
SIEGE_SWING_PER_DEFENDER_DEATH = configFile.getInt("Siege Swing Per Defender Death", CATEGORY_SIEGES, SIEGE_SWING_PER_DEFENDER_DEATH, 0, 1024, "How much a siege progress swings when a defender dies in the siege");
Expand All @@ -419,7 +433,10 @@ public static void SyncConfig(File suggestedFile)
SIEGE_SWING_PER_DAY_ELAPSED_NO_DEFENDER_LOGINS = configFile.getInt("Siege Swing Per Day Without Defender Logins", CATEGORY_SIEGES, SIEGE_SWING_PER_DAY_ELAPSED_NO_DEFENDER_LOGINS, 0, 1024, "How much a siege progress swings when no defenders have logged on for a day (see below)");
SIEGE_DAY_LENGTH = configFile.getFloat("Siege Day Length", CATEGORY_SIEGES, SIEGE_DAY_LENGTH, 0.0001f, 100000f, "The length of a day for siege login purposes, in real-world hours.");
SIEGE_INFO_RADIUS = configFile.getFloat("Siege Info Radius", CATEGORY_SIEGES, SIEGE_INFO_RADIUS, 1f, 1000f, "The range at which you see siege information. (Capped by the server setting)");
SIEGE_SWING_PER_DEFENDER_DEATH = configFile.getInt("Siege Swing Per Defender Death", CATEGORY_SIEGES, SIEGE_SWING_PER_DEFENDER_DEATH, 0, 1024, "How much a siege progress swings when a defender dies in the siege");
SIEGE_SWING_PER_DEFENDER_FLAG = configFile.getInt("Siege Swing Per Defender Flag", CATEGORY_SIEGES, SIEGE_SWING_PER_DEFENDER_FLAG, 0, 1024, "How much the siege swings per defender flag per day");
SIEGE_COOLDOWN_FAIL = configFile.getFloat("Cooldown between sieges after failure", CATEGORY_SIEGES, SIEGE_COOLDOWN_FAIL, 0, 100000f, "Cooldown between sieges, in minutes");
FLAG_COOLDOWN = configFile.getFloat("Cooldown between Flag move", CATEGORY_SIEGES, FLAG_COOLDOWN, 0, 100000f, "Cooldown between flag moves, in minutes");
SIEGE_SWING_PER_ATTACKER_FLAG = configFile.getInt("Siege Swing Per Attacker Flag", CATEGORY_SIEGES, SIEGE_SWING_PER_ATTACKER_FLAG, 0, 1024, "How much the siege swings per attacker flag per day");
SIEGE_DIFFICULTY_PER_DEFENDER_FLAG = configFile.getInt("Siege Difficulty Reinforcement Per Defender Flag", CATEGORY_SIEGES, SIEGE_DIFFICULTY_PER_DEFENDER_FLAG, 0, 1024, "How much having a defender flag at a base reinforces the difficulty of the siege for the attackers");
SIEGE_CAPTURE = configFile.getBoolean("Siege Captures", CATEGORY_SIEGES, SIEGE_CAPTURE, "Does a successful siege convert the claim");
Expand Down
Loading