Skip to content

Commit 3a0a7b3

Browse files
4.12.4 with menu to delay waves
1 parent 58dfaa7 commit 3a0a7b3

File tree

9 files changed

+69
-54
lines changed

9 files changed

+69
-54
lines changed

Ravana_changelog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,10 @@ Replace khalifate with dunefolk
387387
4.12.3
388388
Update for ageless 4.25
389389

390+
4.12.4
391+
Update for ageless 4.27
392+
Experimental menu item in top left corner to delay all waves 1 turn
393+
390394
4.x todo
391395
dependencies=Ageless_Era,XP_Modification,Plan_Your_Advancements_Mod,Switch_Leader,Color_Modification,Ally_Village_Modification
392396

lua/_init.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ ORM.debug = {}
1313
ORM.event = {}
1414
ORM.event.once = {}
1515

16-
ORM.win_turn = 46
17-
1816
function Ravana()
1917
return wesnoth.have_file("~add-ons/DBG_Modification/_main.cfg")
2018
-- return type(rawget(_G,"AE_condition_use_beta_features")) == "function" and AE_condition_use_beta_features()

lua/events.lua

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,22 @@ function ORM.event.new_turn()
1919
if V.ORM_difficulty_mode == "ultrahardcore" then
2020
ORM.fun.increment_hpmultiplier()
2121
end
22-
if wesnoth.current.turn == 30 and V.ORM_difficulty_mode == "normal" then
22+
if ORM.fun.get_effective_turn_number() == 30 and V.ORM_difficulty_mode == "normal" then
2323
-- So that charge, magical and backstab wont be too low
2424
V.ORM_difficulty_setting = V.ORM_difficulty_setting + 0.4
2525
end
2626
if V.ORM_map_setting == "swamp" then
27-
wesnoth.game_config.poison_amount = 10 + wesnoth.current.turn / 4
27+
wesnoth.game_config.poison_amount = 10 + ORM.fun.get_effective_turn_number() / 4
2828
end
2929
ORM.fun.spawn_wave() -- calls unit spawning, label creation, turn bonus
3030
ORM.fun.show_setting_labels() -- remakes labels against bonusspam
3131
end
3232

3333
function ORM.event.start()
3434
V.Rav_DBG_1 = true -- AI side, so able to undroid it and use commands
35+
V.ORM_turn_offset = 0
36+
ORM.win_turn = 46
37+
ORM.turns_to_win_from_last_wave = 6
3538

3639
if V.ORM_hpmultiplier_setting == nil then V.ORM_hpmultiplier_setting = 0 end
3740
V.ORM_hpmultiplier_setting = V.ORM_hpmultiplier_setting * 0.01
@@ -42,10 +45,36 @@ function ORM.event.start()
4245

4346
ORM.fun.remove_turn_limit()
4447
ORM.fun.initialise_difficulty_modes()
48+
49+
wesnoth.wml_actions.set_menu_item{
50+
id='ORM_delay_waves',
51+
description='Make all future waves come 1 turn later',
52+
T.filter_location{
53+
x=1,
54+
y=1
55+
},
56+
T.command{
57+
T.lua{
58+
code='V.ORM_turn_offset = V.ORM_turn_offset + 1'
59+
},
60+
T.lua{
61+
code='wesnoth.message("Use wave delaying at your own risk, and note that if you delay enough times (such as right after wave spawned), you can have previously spawned wave spawn again - effectively endless game mode. Current delay: "..V.ORM_turn_offset.." turn(s)")'
62+
}
63+
}
64+
}
4565
end
4666

4767
function ORM.event.side_1_turn_refresh()
4868
ORM.fun.apply_hpmultiplier()
4969
-- ORM.fun.apply_rush_mod() -- !!!! OOS, so moved to WML
5070
end
71+
72+
function ORM.event.side_turn()
73+
if ORM.fun.get_effective_turn_number() == ORM.win_turn and V.side_number ~= 1 then
74+
wesnoth.wml_actions.endlevel{result="victory"}
75+
end
76+
if ORM.fun.get_effective_turn_number() > ORM.win_turn - ORM.turns_to_win_from_last_wave and #wesnoth.get_units{side=1} < 2 then
77+
wesnoth.wml_actions.end_turn{}
78+
end
79+
end
5180
-->>

lua/helper_functions.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,4 +302,8 @@ function ORM.fun.show_setting_labels()
302302
})
303303
end
304304

305+
function ORM.fun.get_effective_turn_number()
306+
return wesnoth.current.turn - V.ORM_turn_offset
307+
end
308+
305309
-->>

lua/spawn_functions.lua

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ function ORM.fun.spawn_unit_set(level, location, original_type)
6363
end
6464

6565
function ORM.fun.spawn_wave()
66-
if ORM.waves["t"..wesnoth.current.turn] ~= nil then
67-
for _,v in ipairs(ORM.waves["t"..wesnoth.current.turn]) do
66+
if ORM.waves["t"..ORM.fun.get_effective_turn_number()] ~= nil then
67+
for _,v in ipairs(ORM.waves["t"..ORM.fun.get_effective_turn_number()]) do
6868
ORM.fun.spawn_unit_set(v.random_level, v.location, v.original_type)
6969
end
7070
ORM.fun.update_spawn_labels()
@@ -73,12 +73,12 @@ function ORM.fun.spawn_wave()
7373
end
7474

7575
function ORM.fun.apply_wave_modifications()
76-
if ORM.unit_bonuses["t"..wesnoth.current.turn] == nil then return end
76+
if ORM.unit_bonuses["t"..ORM.fun.get_effective_turn_number()] == nil then return end
7777

7878
local difficulty = V.ORM_difficulty_mode
7979

80-
if V.ORM_wave_choice_setting == "core_predefined" and (difficulty == "normal" or difficulty=="hardcore") and ORM.unit_bonuses["t"..wesnoth.current.turn]["predefined"] ~= nil then difficulty = "predefined" end
81-
local bonus = ORM.unit_bonuses["t"..wesnoth.current.turn][difficulty]
80+
if V.ORM_wave_choice_setting == "core_predefined" and (difficulty == "normal" or difficulty=="hardcore") and ORM.unit_bonuses["t"..ORM.fun.get_effective_turn_number()]["predefined"] ~= nil then difficulty = "predefined" end
81+
local bonus = ORM.unit_bonuses["t"..ORM.fun.get_effective_turn_number()][difficulty]
8282
local units = wesnoth.get_units { side = 1 }
8383
if bonus == nil then return end
8484
for _,u in ipairs(units) do
@@ -106,8 +106,8 @@ function ORM.fun.update_spawn_labels()
106106
local waveSetting = V.ORM_wave_choice_setting
107107

108108
-- remove labels after spawning
109-
if ORM.waves["t"..wesnoth.current.turn] ~= nil then
110-
for _,v in ipairs(ORM.waves["t"..wesnoth.current.turn]) do
109+
if ORM.waves["t"..ORM.fun.get_effective_turn_number()] ~= nil then
110+
for _,v in ipairs(ORM.waves["t"..ORM.fun.get_effective_turn_number()]) do
111111
for _,loc in ipairs(v.location) do
112112
if wesnoth.sides[loc.for_side].controller ~= "null" or V.ORM_spawn_for_empty then
113113
ORM.fun.backport_label({
@@ -123,12 +123,12 @@ function ORM.fun.update_spawn_labels()
123123
end
124124
end
125125

126-
local next_wave = wesnoth.current.turn+1
126+
local next_wave = ORM.fun.get_effective_turn_number()+1
127127
local wave_trial_limit = next_wave + 10
128128
while ORM.waves["t"..next_wave] == nil do
129129
next_wave = next_wave+1
130130
if next_wave > wave_trial_limit then
131-
if wesnoth.current.turn ~= ORM.win_turn then
131+
if ORM.fun.get_effective_turn_number() ~= ORM.win_turn then
132132
helper.wml_error("ORM.fun.update_spawn_labels() finding next wave failed")
133133
end
134134
return
@@ -159,13 +159,13 @@ function ORM.fun.update_spawn_labels()
159159
x=14,
160160
y=2,
161161
color="255,127,0",
162-
text="Turn "..next_wave..": " .. spawn_label_text
162+
text="Turn "..next_wave+V.ORM_turn_offset..": " .. spawn_label_text
163163
})
164164
ORM.fun.backport_label({
165165
x=14,
166166
y=21,
167167
color="255,127,0",
168-
text="Turn "..next_wave..": " .. spawn_label_text
168+
text="Turn "..next_wave+V.ORM_turn_offset..": " .. spawn_label_text
169169
})
170170
end
171171

scenarios/OrociaRandomMod.cfg

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Ultra hardcore is designed to be ultra, balance has not been tested, noone is kn
1717
{DEFAULT_MUSIC_PLAYLIST}
1818
{ORM_SHRINE_UPGRADE}
1919
[options]
20-
[combo]
20+
[choice]
2121
id=ORM_difficulty_mode
2222
default=normal
2323
name=_"Difficulty mode"
@@ -38,8 +38,8 @@ Ultra hardcore is designed to be ultra, balance has not been tested, noone is kn
3838
name="Easy"
3939
value=easy
4040
[/item]
41-
[/combo]
42-
[combo]
41+
[/choice]
42+
[choice]
4343
id=ORM_upgrade_setting
4444
default=2
4545
name=_"Upgrade type"
@@ -67,8 +67,8 @@ Ultra hardcore is designed to be ultra, balance has not been tested, noone is kn
6767
name=_"Mega Chaos (Zonk/res/hp/dmg/mv/str/def)"
6868
value=4
6969
[/item]
70-
[/combo]
71-
[combo]
70+
[/choice]
71+
[choice]
7272
id=ORM_map_setting
7373
default=default
7474
name=_"Map type"
@@ -93,8 +93,8 @@ Ultra hardcore is designed to be ultra, balance has not been tested, noone is kn
9393
name="Frozen"
9494
value=frozen
9595
[/item]
96-
[/combo]
97-
[combo]
96+
[/choice]
97+
[choice]
9898
id=ORM_wave_choice_setting
9999
default=ageless_random_full
100100
name=_"Wavetype"
@@ -124,7 +124,7 @@ Ultra hardcore is designed to be ultra, balance has not been tested, noone is kn
124124
value=debug
125125
[/item]
126126
#endif
127-
[/combo]
127+
[/choice]
128128
[checkbox]
129129
id=ORM_individualupgrade_setting
130130
default=yes
@@ -378,7 +378,5 @@ A unit at the shrine could receive an empowerment.
378378
{OROCIARM_WEAPON_ARSENAL 25 9}
379379
[/event]
380380

381-
{OROCIARM_TURN46}
382-
383381
{OROCIARM_HERO_DIES}
384382
[/multiplayer]

utils/lua_init.cfg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ ORM.event.once.new_turn()
6868
[lua]
6969
code=<<
7070
ORM.event.start()
71+
>>
72+
[/lua]
73+
[/event]
74+
75+
[event]
76+
name=side turn
77+
first_time_only=no
78+
[lua]
79+
code=<<
80+
ORM.event.side_turn()
7181
>>
7282
[/lua]
7383
[/event]

utils/start_end_s.cfg

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,5 @@
11
#textdomain wesnoth-OrociaRandomMod
22

3-
#define OROCIARM_TURN46
4-
[event]
5-
name=side 2 turn 46
6-
[endlevel]
7-
result=victory
8-
[/endlevel]
9-
[/event]
10-
[event]
11-
name=side turn
12-
first_time_only=no
13-
[filter_condition]
14-
[variable]
15-
name=turn_number
16-
greater_than=40
17-
[/variable]
18-
[not]
19-
[have_unit]
20-
count=2-99999
21-
side=1
22-
[/have_unit]
23-
[/not]
24-
[/filter_condition]
25-
[end_turn]
26-
[/end_turn]
27-
[/event]
28-
#enddef
29-
303
#define OROCIARM_HERO_DIES
314
[event]
325
name=last breath
@@ -38,7 +11,6 @@
3811
[message]
3912
speaker=unit
4013
message= _ "It was not meant to be..."
41-
duration=5
4214
[/message]
4315
[/event]
4416
#enddef

utils/version.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#wmlindent: start ignoring
22
#define OROCIARM_VERSION
3-
4.12.3 by Ravana
3+
4.12.4 by Ravana
44
Leave feedback in is.gd/laelamp
55
#enddef
66
#wmlindent: stop ignoring

0 commit comments

Comments
 (0)