Skip to content

Commit c4ab10c

Browse files
committed
Added effect modifier for bag of holding
1 parent fadb60f commit c4ab10c

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

mods/bagofholding.disabled

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
classname=org.gotti.wurmunlimited.mods.bagofholding.BagOfHoldingMod
22
classpath=bagofholding.jar
33
sharedClassLoader=true
4+
# spellCost: favor costs of the spell
45
spellCost=30
6+
# spellDifficulty: difficulty. 20 is the same as courier
57
spellDifficulty=20
8+
# spellCooldown: cooldown in milliseconds
9+
# 300000 is 5 minutes
610
spellCooldown=300000
11+
# effectModifier: Determines how much larger the containers become
12+
# 0: spell power directly determines the increase. a 10 cast will make the container 10 times larger
13+
# any other number: quadratic progression up to effectModifier additional volume
14+
# An effectModifier of 10 will give 2.5 times additional volume for a 50 cast and 10 times additional volume for a 100 cast.
15+
effectModifier=10

src/mods/bagofholding/org/gotti/wurmunlimited/mods/bagofholding/BagOfHoldingMod.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class BagOfHoldingMod implements WurmMod, Initable, PreInitable, Configur
2828
private int spellCost = 30;
2929
private int spellDifficulty = 20;
3030
private long spellCooldown = 300000L;
31+
private int effectModifier = 0;
3132

3233
private static final Logger logger = Logger.getLogger(BagOfHoldingMod.class.getName());
3334

@@ -53,10 +54,12 @@ public void configure(Properties properties) {
5354
spellCost = Integer.valueOf(properties.getProperty("spellCost", Integer.toString(spellCost)));
5455
spellDifficulty = Integer.valueOf(properties.getProperty("spellDifficulty", Integer.toString(spellDifficulty)));
5556
spellCooldown = Long.valueOf(properties.getProperty("spellCooldown", Long.toString(spellCooldown)));
57+
effectModifier = Integer.valueOf(properties.getProperty("effectModifier", Integer.toString(effectModifier)));
5658

5759
logger.log(Level.INFO, "spellCost: " + spellCost);
5860
logger.log(Level.INFO, "spellDifficulty: " + spellDifficulty);
5961
logger.log(Level.INFO, "spellCooldown: " + spellCooldown);
62+
logger.log(Level.INFO, "effectModifier: " + effectModifier);
6063
}
6164

6265
@Override
@@ -80,8 +83,15 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
8083
Item target = (Item)proxy;
8184

8285
float modifier = BagOfHolding.getSpellEffect(target);
83-
if (modifier > 1) {
84-
double newVolume = Math.min(Integer.MAX_VALUE, modifier * ((Number) volume).doubleValue());
86+
87+
if (effectModifier == 0) {
88+
if (modifier > 1) {
89+
double newVolume = Math.min(Integer.MAX_VALUE, modifier * ((Number) volume).doubleValue());
90+
return (int) newVolume;
91+
}
92+
} else if (modifier > 0) {
93+
double scale = 1 + modifier * modifier * effectModifier * 0.0001;
94+
double newVolume = Math.min(Integer.MAX_VALUE, scale * ((Number) volume).doubleValue());
8595
return (int) newVolume;
8696
}
8797
}

0 commit comments

Comments
 (0)