Skip to content

Commit 8be06e8

Browse files
authored
Merge pull request #20 from armanaxh/misc-debuging
Misc debuging
2 parents f7acd52 + 6cc029c commit 8be06e8

File tree

7 files changed

+167
-133
lines changed

7 files changed

+167
-133
lines changed

boot/config/misc.cfg

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,16 @@ misc.injury.fire.k: 0.00025
191191
misc.injury.fire.l: 0.03
192192
misc.injury.fire.noise.mean: 0.1
193193
misc.injury.fire.noise.sd: 0.01
194+
195+
196+
# Gas Station Misc config
197+
198+
misc.gas_station.Buriedness.bound: 30
199+
misc.gas_station.Buriedness.min: 0
200+
misc.gas_station.Damage.bound: 50
201+
misc.gas_station.Damage.min: 15
202+
203+
204+
205+
206+

lib/rescuecore.jar

-25 Bytes
Binary file not shown.

lib/resq-fire.jar

1 Byte
Binary file not shown.

modules/misc/src/misc/DamageType.java

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,44 @@
88
import org.uncommons.maths.number.NumberGenerator;
99

1010
/**
11-
Container for information about different damage types.
12-
*/
11+
Container for information about different damage types.
12+
*/
1313
public class DamageType {
1414
private String type;
1515
private double k;
1616
private double l;
17-
private Random random;
1817
private NumberGenerator<Double> noise;
1918

2019
private double damage;
2120

2221
/**
23-
Construct a DamageType.
24-
@param type The name of this type.
25-
@param config The system configuration.
22+
Construct a DamageType.
23+
@param type The name of this type.
24+
@param config The system configuration.
25+
@param Random sequence proprietary.
2626
*/
27-
public DamageType(String type, Config config) {
27+
public DamageType(String type, Config config, Random random) {
2828
this.type = type;
2929
k = config.getFloatValue("misc.injury." + type + ".k");
3030
l = config.getFloatValue("misc.injury." + type + ".l");
3131
double mean = config.getFloatValue("misc.injury." + type + ".noise.mean");
3232
double sd = config.getFloatValue("misc.injury." + type + ".noise.sd");
33-
random = config.getRandom();
3433
noise = new GaussianGenerator(mean, sd, random);
3534
damage = 0;
3635
}
3736

3837
/**
39-
Get the type name.
40-
@return The type name.
41-
*/
38+
Get the type name.
39+
@return The type name.
40+
*/
4241
public String getType() {
4342
return type;
4443
}
4544

4645
/**
47-
Compute damage progression for this type.
48-
@return The new damage.
49-
*/
46+
Compute damage progression for this type.
47+
@return The new damage.
48+
*/
5049
public double progress() {
5150
if (damage <= 0) {
5251
return damage;
@@ -57,25 +56,25 @@ public double progress() {
5756
}
5857

5958
/**
60-
Get the current damage.
61-
@return The current damage.
62-
*/
59+
Get the current damage.
60+
@return The current damage.
61+
*/
6362
public double getDamage() {
6463
return damage;
6564
}
6665

6766
/**
68-
Set the current damage.
69-
@param d The current damage.
70-
*/
67+
Set the current damage.
68+
@param d The current damage.
69+
*/
7170
public void setDamage(double d) {
7271
damage = d;
7372
}
7473

7574
/**
76-
Add some damage.
77-
@param d The amount to add.
78-
*/
75+
Add some damage.
76+
@param d The amount to add.
77+
*/
7978
public void addDamage(double d) {
8079
damage += d;
8180
}

modules/misc/src/misc/HumanAttributes.java

Lines changed: 60 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,137 +5,149 @@
55

66
import rescuecore2.standard.entities.Human;
77

8+
import java.util.Random;
9+
810
/**
9-
Class for holding information about humans.
10-
*/
11+
Class for holding information about humans.
12+
*/
1113
public class HumanAttributes {
1214
private Human human;
1315
private EntityID id;
1416
private DamageType damageFire;
1517
private DamageType damageCollapse;
1618
private DamageType damageBury;
19+
private Random random;
1720

1821
/**
19-
Construct a HumanAttributes object that wraps a Human.
20-
@param h The Human to wrap.
21-
@param config The system configuration.
22-
*/
22+
Construct a HumanAttributes object that wraps a Human.
23+
@param h The Human to wrap.
24+
@param config The system configuration.
25+
*/
2326
public HumanAttributes(Human h, Config config) {
2427
this.human = h;
2528
this.id = h.getID();
26-
damageFire = new DamageType("fire", config);
27-
damageCollapse = new DamageType("collapse", config);
28-
damageBury = new DamageType("bury", config);
29+
// Generate Random for each Human
30+
this.random = new Random(config.getRandom().nextLong());
31+
damageFire = new DamageType("fire", config, random);
32+
damageCollapse = new DamageType("collapse", config, random);
33+
damageBury = new DamageType("bury", config, random);
2934
}
3035

3136
/**
32-
Get the ID of the wrapped human.
33-
@return The human ID.
34-
*/
37+
Get the ID of the wrapped human.
38+
@return The human ID.
39+
*/
3540
public EntityID getID() {
3641
return id;
3742
}
3843

3944
/**
40-
Get the wrapped human.
41-
@return The wrapped human.
42-
*/
45+
Get the wrapped human.
46+
@return The wrapped human.
47+
*/
4348
public Human getHuman() {
4449
return human;
4550
}
4651

4752
/**
48-
Add some collapse damage.
49-
@param d The amount of damage to add.
50-
*/
53+
Get the random sequence of the wrapped human.
54+
@return The random sequence.
55+
*/
56+
public Random getRandom(){
57+
return random;
58+
}
59+
/**
60+
Add some collapse damage.
61+
@param d The amount of damage to add.
62+
*/
5163
public void addCollapseDamage(double d) {
5264
damageCollapse.addDamage(d);
5365
}
5466

5567
/**
56-
Get the amount of collapse damage this human has.
57-
@return The amount of collapse damage.
58-
*/
68+
Get the amount of collapse damage this human has.
69+
@return The amount of collapse damage.
70+
*/
5971
public double getCollapseDamage() {
6072
return damageCollapse.getDamage();
6173
}
6274

6375
/**
64-
Set the amount of collapse damage this human has.
65-
@param d The new collapse damage.
66-
*/
76+
Set the amount of collapse damage this human has.
77+
@param d The new collapse damage.
78+
*/
6779
public void setCollapseDamage(double d) {
6880
damageCollapse.setDamage(d);
6981
}
7082

7183
/**
72-
Add some buriedness damage.
73-
@param d The amount of damage to add.
74-
*/
84+
Add some buriedness damage.
85+
@param d The amount of damage to add.
86+
*/
7587
public void addBuriednessDamage(double d) {
7688
damageBury.addDamage(d);
7789
}
7890

7991
/**
80-
Get the amount of buriedness damage this human has.
81-
@return The amount of buriedness damage.
82-
*/
92+
Get the amount of buriedness damage this human has.
93+
@return The amount of buriedness damage.
94+
*/
8395
public double getBuriednessDamage() {
8496
return damageBury.getDamage();
8597
}
8698

8799
/**
88-
Set the amount of buriedness damage this human has.
89-
@param d The new buriedness damage.
90-
*/
100+
Set the amount of buriedness damage this human has.
101+
@param d The new buriedness damage.
102+
*/
91103
public void setBuriednessDamage(double d) {
92104
damageBury.setDamage(d);
93105
}
94106

95107
/**
96-
Add some fire damage.
97-
@param d The amount of damage to add.
98-
*/
108+
Add some fire damage.
109+
@param d The amount of damage to add.
110+
*/
99111
public void addFireDamage(double d) {
100112
damageFire.addDamage(d);
101113
}
102114

103115
/**
104-
Get the amount of fire damage this human has.
105-
@return The amount of fire damage.
106-
*/
116+
Get the amount of fire damage this human has.
117+
@return The amount of fire damage.
118+
*/
107119
public double getFireDamage() {
108120
return damageFire.getDamage();
109121
}
110122

111123
/**
112-
Set the amount of fire damage this human has.
113-
@param d The new fire damage.
114-
*/
124+
Set the amount of fire damage this human has.
125+
@param d The new fire damage.
126+
*/
115127
public void setFireDamage(double d) {
116128
damageFire.setDamage(d);
117129
}
118130

119131
/**
120-
Get the total damage of this human, rounded to the nearest integer.
121-
@return The total damage.
132+
Get the total damage of this human, rounded to the nearest integer.
133+
@return The total damage.
122134
*/
123135
public int getTotalDamage() {
124136
return (int)Math.round(damageCollapse.getDamage() + damageFire.getDamage() + damageBury.getDamage());
125137
}
126138

127139
/**
128-
Progress all damage types.
129-
*/
140+
Progress all damage types.
141+
*/
130142
public void progressDamage() {
131143
damageCollapse.progress();
132144
damageFire.progress();
133145
damageBury.progress();
134146
}
135147

136148
/**
137-
Clear all damage.
138-
*/
149+
Clear all damage.
150+
*/
139151
public void clearDamage() {
140152
damageCollapse.setDamage(0);
141153
damageBury.setDamage(0);

0 commit comments

Comments
 (0)