Skip to content

Commit 6302960

Browse files
committed
update
1 parent 71bc12e commit 6302960

246 files changed

Lines changed: 6594 additions & 5812 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

forge-gui-mobile/src/forge/adventure/data/BiomeData.java

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
import com.badlogic.gdx.graphics.Color;
44
import com.badlogic.gdx.utils.Array;
5+
6+
import forge.adventure.player.AdventurePlayer;
7+
import forge.adventure.player.PlayerStatistic;
58
import forge.adventure.util.AdventureQuestController;
9+
import forge.adventure.util.Current;
610
import forge.util.Aggregates;
711
import forge.util.MyRandom;
812

@@ -100,20 +104,32 @@ public EnemyData getExtraSpawnEnemy(float difficultyFactor) {
100104
}
101105

102106
public EnemyData getEnemy(float difficultyFactor) {
103-
//todo: implement difficultyFactor
104107
float totalDistribution = 0.0f;
105-
for (EnemyData data : enemyList) {
106-
totalDistribution += data.spawnRate;
108+
difficultyFactor = Current.player().getStatistic().rank(); //// conpare difficulty data to on how many wins you have on your save
109+
List<EnemyData> filteredEnemies = new ArrayList<>();
110+
for (EnemyData data : enemyList ){
111+
if (data.difficulty <= difficultyFactor) {
112+
filteredEnemies.add(data);
113+
totalDistribution += data.spawnRate;
114+
}
107115
}
116+
// If no enemies match the criteria, fallback to a random enemy from the original list
117+
if (filteredEnemies.isEmpty()) {
118+
return Aggregates.random(enemyList);
119+
}
120+
121+
// Perform weighted random selection
122+
float f = totalDistribution * rand.nextFloat();
108123
int i = 0;
109-
for (float f = totalDistribution * rand.nextFloat(); i < enemyList.size(); i++)
110-
{
111-
f -= ( enemyList.get(i).spawnRate);
112-
if (f <= 0.0f){
113-
return enemyList.get(i);
124+
for (; i < filteredEnemies.size(); i++) {
125+
f -= filteredEnemies.get(i).spawnRate;
126+
if (f <= 0.0f) {
127+
return filteredEnemies.get(i);
114128
}
115129
}
116-
return Aggregates.random(enemyList); //fallback, shouldn't reach this point but guarantee that we return something
130+
131+
// Fallback, should not normally reach here
132+
return Aggregates.random(filteredEnemies);
117133
}
118134

119135
private ArrayList<String> unusedTownNames;

forge-gui-mobile/src/forge/adventure/player/AdventurePlayer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ public String getName() {
320320
public Boolean isFemale() {
321321
return isFemale;
322322
}
323-
324323
public float getWorldPosX() {
325324
return worldPosX;
326325
}

forge-gui-mobile/src/forge/adventure/player/PlayerStatistic.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@ public int totalWins()
3030
}
3131
return wins;
3232
}
33+
public float rank() ///// used for overworld enemy spawn
34+
{
35+
int wins=0;
36+
for(Map.Entry<String, Pair<Integer, Integer>> value:winLossRecord.entrySet())
37+
{
38+
wins+=value.getValue().getLeft();
39+
}
40+
if (wins < 20) {
41+
return 0.5f;
42+
} else if (wins >= 20 && wins < 60) {
43+
return 1;
44+
} else if (wins >= 60 && wins <= 150) {
45+
return 2;
46+
} else { // wins > 150
47+
return 10;
48+
}
49+
}
3350
public int totalLoss()
3451
{
3552
int loss=0;

forge-gui/res/adventure/Shandalar Old Border/maps/map/aerie/wastetown..tmx

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="50" height="40" tilewidth="16" tileheight="16" infinite="0" nextlayerid="11" nextobjectid="129">
3-
<tileset firstgid="1" source="../../../../../../common/maps/tileset/main.tsx"/>
4-
<tileset firstgid="10113" source="../../../../../../common/maps/tileset/buildings.tsx"/>
5-
<tileset firstgid="11905" source="../../../../../../common/maps/tileset/dungeon.tsx"/>
6-
<tileset firstgid="16001" source="../../../../../../common/maps/tileset/FarmFood.tsx"/>
3+
<tileset firstgid="1" source="../../../../common/maps/tileset/main.tsx"/>
4+
<tileset firstgid="10113" source="../../../../common/maps/tileset/buildings.tsx"/>
5+
<tileset firstgid="11905" source="../../../../common/maps/tileset/dungeon.tsx"/>
6+
<tileset firstgid="16001" source="../../../../common/maps/tileset/FarmFood.tsx"/>
77
<layer id="10" name="Collision" width="50" height="40">
88
<data encoding="base64" compression="zlib">
99
eJztz0EKgDAMRNHu9QbqVT2Z3k1dBEQQ2yTFtPwH2SVhJiUAAIB+rcP3RLeNeXt75t4fcjuIiF1KO4hIXbQdRIQu05lhMebw+GFFD98fVvTw/WFFD98fHmZjBuu9lyuHNovl1ptkKc2jvavlnic3k+amtmcmzUTRQwfRQwfxlrWlDgAAtOYAbb4bLg==
@@ -38,64 +38,64 @@
3838
</data>
3939
</layer>
4040
<objectgroup id="4" name="Objects">
41-
<object id="90" template="../../../../../../common/maps/obj/door_left.tx" x="397.5" y="496.5" width="20" height="20">
41+
<object id="90" template="../../../../common/maps/obj/door_left.tx" x="397.5" y="496.5" width="20" height="20">
4242
<properties>
4343
<property name="direction" value="up"/>
4444
<property name="teleport" value="../Shandalar Old Border/maps/map/aerie/aerie_1.tmx"/>
4545
<property name="teleportObjectId" value="38"/>
4646
</properties>
4747
</object>
48-
<object id="91" template="../../../../../../common/maps/obj/enemy.tx" x="138.284" y="133.754">
48+
<object id="91" template="../../../../common/maps/obj/enemy.tx" x="138.284" y="133.754">
4949
<properties>
5050
<property name="enemy" value="Griffin"/>
5151
<property name="threatRange" type="int" value="30"/>
5252
<property name="waypoints" value="118,121,120"/>
5353
</properties>
5454
</object>
55-
<object id="92" template="../../../../../../common/maps/obj/enemy.tx" x="336.16" y="575.997">
55+
<object id="92" template="../../../../common/maps/obj/enemy.tx" x="336.16" y="575.997">
5656
<properties>
5757
<property name="enemy" value="Aerie Guard"/>
5858
</properties>
5959
</object>
60-
<object id="94" template="../../../../../../common/maps/obj/gold.tx" x="709.083" y="51.833"/>
61-
<object id="95" template="../../../../../../common/maps/obj/gold.tx" x="23.894" y="33.341"/>
62-
<object id="97" template="../../../../../../common/maps/obj/enemy.tx" x="400.5" y="513.333">
60+
<object id="94" template="../../../../common/maps/obj/gold.tx" x="709.083" y="51.833"/>
61+
<object id="95" template="../../../../common/maps/obj/gold.tx" x="23.894" y="33.341"/>
62+
<object id="97" template="../../../../common/maps/obj/enemy.tx" x="400.5" y="513.333">
6363
<properties>
6464
<property name="enemy" value="Artifact Warrior"/>
6565
<property name="threatRange" type="int" value="0"/>
6666
</properties>
6767
</object>
68-
<object id="99" template="../../../../../../common/maps/obj/enemy.tx" x="129.829" y="248.132">
68+
<object id="99" template="../../../../common/maps/obj/enemy.tx" x="129.829" y="248.132">
6969
<properties>
7070
<property name="enemy" value="Scarab"/>
7171
<property name="threatRange" type="int" value="30"/>
7272
<property name="waypoints" value="119,120,119,117"/>
7373
</properties>
7474
</object>
75-
<object id="100" template="../../../../../../common/maps/obj/enemy.tx" x="407.538" y="233.709">
75+
<object id="100" template="../../../../common/maps/obj/enemy.tx" x="407.538" y="233.709">
7676
<properties>
7777
<property name="enemy" value="Griffin"/>
7878
<property name="threatRange" type="int" value="30"/>
7979
</properties>
8080
</object>
81-
<object id="102" template="../../../../../../common/maps/obj/gold.tx" x="431.962" y="417.046"/>
82-
<object id="103" template="../../../../../../common/maps/obj/gold.tx" x="414.938" y="417.887"/>
83-
<object id="104" template="../../../../../../common/maps/obj/door_left.tx" x="386.212" y="335.546" width="20" height="39.5">
81+
<object id="102" template="../../../../common/maps/obj/gold.tx" x="431.962" y="417.046"/>
82+
<object id="103" template="../../../../common/maps/obj/gold.tx" x="414.938" y="417.887"/>
83+
<object id="104" template="../../../../common/maps/obj/door_left.tx" x="386.212" y="335.546" width="20" height="39.5">
8484
<properties>
8585
<property name="direction" value="up"/>
8686
<property name="teleport" value="../Shandalar Old Border/maps/map/aerie/aerie_4.tmx"/>
8787
<property name="teleportObjectId" value="88"/>
8888
</properties>
8989
</object>
90-
<object id="105" template="../../../../../../common/maps/obj/manashards.tx" x="371.712" y="418.546"/>
91-
<object id="106" template="../../../../../../common/maps/obj/manashards.tx" x="393.712" y="418.546"/>
92-
<object id="108" template="../../../../../../common/maps/obj/enemy.tx" x="471.212" y="379.546">
90+
<object id="105" template="../../../../common/maps/obj/manashards.tx" x="371.712" y="418.546"/>
91+
<object id="106" template="../../../../common/maps/obj/manashards.tx" x="393.712" y="418.546"/>
92+
<object id="108" template="../../../../common/maps/obj/enemy.tx" x="471.212" y="379.546">
9393
<properties>
9494
<property name="enemy" value="Griffin"/>
9595
<property name="threatRange" type="int" value="30"/>
9696
</properties>
9797
</object>
98-
<object id="110" template="../../../../../../common/maps/obj/booster.tx" x="372.5" y="403">
98+
<object id="110" template="../../../../common/maps/obj/booster.tx" x="372.5" y="403">
9999
<properties>
100100
<property name="reward">[
101101
{
@@ -120,7 +120,7 @@
120120
</property>
121121
</properties>
122122
</object>
123-
<object id="111" template="../../../../../../common/maps/obj/booster.tx" x="394.5" y="402">
123+
<object id="111" template="../../../../common/maps/obj/booster.tx" x="394.5" y="402">
124124
<properties>
125125
<property name="reward">[
126126
{
@@ -145,7 +145,7 @@
145145
</property>
146146
</properties>
147147
</object>
148-
<object id="112" template="../../../../../../common/maps/obj/booster.tx" x="415.5" y="403.5">
148+
<object id="112" template="../../../../common/maps/obj/booster.tx" x="415.5" y="403.5">
149149
<properties>
150150
<property name="reward">[
151151
{
@@ -170,45 +170,45 @@
170170
</property>
171171
</properties>
172172
</object>
173-
<object id="113" template="../../../../../../common/maps/obj/enemy.tx" x="327" y="378.5">
173+
<object id="113" template="../../../../common/maps/obj/enemy.tx" x="327" y="378.5">
174174
<properties>
175175
<property name="enemy" value="Griffin"/>
176176
<property name="threatRange" type="int" value="30"/>
177177
</properties>
178178
</object>
179-
<object id="114" template="../../../../../../common/maps/obj/enemy.tx" x="733" y="275">
179+
<object id="114" template="../../../../common/maps/obj/enemy.tx" x="733" y="275">
180180
<properties>
181181
<property name="enemy" value="Griffin"/>
182182
<property name="threatRange" type="int" value="30"/>
183183
<property name="waypoints" value="123,124,122"/>
184184
</properties>
185185
</object>
186-
<object id="115" template="../../../../../../common/maps/obj/enemy.tx" x="608.5" y="151.5">
186+
<object id="115" template="../../../../common/maps/obj/enemy.tx" x="608.5" y="151.5">
187187
<properties>
188188
<property name="enemy" value="Scarab"/>
189189
<property name="threatRange" type="int" value="30"/>
190190
<property name="waypoints" value="125,123,127,128,122,128"/>
191191
</properties>
192192
</object>
193-
<object id="116" template="../../../../../../common/maps/obj/shop.tx" x="319" y="568">
193+
<object id="116" template="../../../../common/maps/obj/shop.tx" x="319" y="568">
194194
<properties>
195195
<property name="commonShopList" value="Plains"/>
196196
<property name="noRestock" type="bool" value="true"/>
197197
<property name="signXOffset" type="float" value="-32"/>
198198
<property name="signYOffset" type="float" value="0"/>
199199
</properties>
200200
</object>
201-
<object id="117" template="../../../../../../common/maps/obj/waypoint.tx" x="70" y="217.5"/>
202-
<object id="118" template="../../../../../../common/maps/obj/waypoint.tx" x="329.5" y="46"/>
203-
<object id="119" template="../../../../../../common/maps/obj/waypoint.tx" x="181.5" y="367.5"/>
204-
<object id="120" template="../../../../../../common/maps/obj/waypoint.tx" x="51.5" y="488.5"/>
205-
<object id="121" template="../../../../../../common/maps/obj/waypoint.tx" x="56.5" y="59.5"/>
206-
<object id="122" template="../../../../../../common/maps/obj/waypoint.tx" x="706.5" y="79.5"/>
207-
<object id="123" template="../../../../../../common/maps/obj/waypoint.tx" x="577.5" y="322.5"/>
208-
<object id="124" template="../../../../../../common/maps/obj/waypoint.tx" x="749.5" y="490"/>
209-
<object id="125" template="../../../../../../common/maps/obj/waypoint.tx" x="571" y="203.5"/>
210-
<object id="126" template="../../../../../../common/maps/obj/waypoint.tx" x="623" y="614"/>
211-
<object id="127" template="../../../../../../common/maps/obj/waypoint.tx" x="645" y="159"/>
212-
<object id="128" template="../../../../../../common/maps/obj/waypoint.tx" x="712" y="158.5"/>
201+
<object id="117" template="../../../../common/maps/obj/waypoint.tx" x="70" y="217.5"/>
202+
<object id="118" template="../../../../common/maps/obj/waypoint.tx" x="329.5" y="46"/>
203+
<object id="119" template="../../../../common/maps/obj/waypoint.tx" x="181.5" y="367.5"/>
204+
<object id="120" template="../../../../common/maps/obj/waypoint.tx" x="51.5" y="488.5"/>
205+
<object id="121" template="../../../../common/maps/obj/waypoint.tx" x="56.5" y="59.5"/>
206+
<object id="122" template="../../../../common/maps/obj/waypoint.tx" x="706.5" y="79.5"/>
207+
<object id="123" template="../../../../common/maps/obj/waypoint.tx" x="577.5" y="322.5"/>
208+
<object id="124" template="../../../../common/maps/obj/waypoint.tx" x="749.5" y="490"/>
209+
<object id="125" template="../../../../common/maps/obj/waypoint.tx" x="571" y="203.5"/>
210+
<object id="126" template="../../../../common/maps/obj/waypoint.tx" x="623" y="614"/>
211+
<object id="127" template="../../../../common/maps/obj/waypoint.tx" x="645" y="159"/>
212+
<object id="128" template="../../../../common/maps/obj/waypoint.tx" x="712" y="158.5"/>
213213
</objectgroup>
214214
</map>

0 commit comments

Comments
 (0)