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

[unit_type_fix] testing #4099

Open
gfgtdf opened this issue May 31, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@gfgtdf
Copy link
Contributor

commented May 31, 2019

This is more of a reminder for myself: I didn't test yet whether [unit_type_fix] correctly applies the changes to subtypes (in particular: variations)

@gfgtdf gfgtdf self-assigned this May 31, 2019

@spixi

This comment has been minimized.

Copy link
Contributor

commented Jun 1, 2019

It would be great, if [unit_type_fix] supported conditionals.

The following code (supposed to get rid of [advance_from]) does not work, unfortunately.

#define TRISTATE
	[item]
		name=_ "default"
		value="default"
	[/item]
	[item]
		name=_ "yes"
		value="yes"
	[/item]
	[item]
		name=_ "no"
		value="no"
	[/item]
	default="default"
#enddef

[modification]
    id=mainline_unit_tree_enhancements
    name=_"mainline_unit_tree_enhancements"
    description=_"mainline_unit_tree_enhancements"
    require_modification=yes
	type=hybrid

	[options]
		[choice]
			id=enable_armageddon_drake
			name=_"Enable Armageddon Drake"
			description=_"allows the advancement Inferno Drake → Armageddon Drake"
			{TRISTATE}
		[/choice]
		[choice]
			id=enable_dwarvish_arcanister
			name=_"Enable Dwarvish Arcanister"
			description=_"allows the advancement Dwarvish Runemaster → Dwarvish Arcanister"
			{TRISTATE}
		[/choice]
		[choice]
			id=enable_dwarvish_runesmith
			name=_"Enable Dwarvish Runesmith"
			description=_"allows the advancement Dwarvish Fighter → Dwarvish Runesmith"
			{TRISTATE}
		[/choice]
		[choice]
			id=enable_grand_marshal
			name=_"Enable Grand Marshal"
			description=_"allows the advancement General → Grand Marshal"
			{TRISTATE}
		[/choice]
		[choice]
			id=enable_ancient_lich
			name=_"Enable Ancient Lich"
			description=_"allows the advancement Lich → Ancient Lich"
			{TRISTATE}
		[/choice]
		[choice]
			id=enable_death_knight
			name=_"Enable Death Knight"
			description=_"allows the advancement Revenant → Death Knight"
			{TRISTATE}
		[/choice]
		[choice]
			id=enable_troll_shaman
			name=_"Enable Troll Shaman"
			description=_"allows the advancement Troll Whelp → Troll Shaman"
			{TRISTATE}
		[/choice]
		[choice]
			id=enable_wolf_advancement
			name=_"Enable Wolf Advancement"
			description=_"allows the advancement Wolf → Great Wolf → Direwolf"
			{TRISTATE}
		[/choice]
		[choice]
			id=enable_nightblade
			name=_"Enable Night Blade"
			description=_"allows the advancement Orcish Slayer → Orcish Nightblade"
			{TRISTATE}
		[/choice]
		[choice]
			id=enable_warmaster
			name=_"Enable Dune Warmaster"
			description=_"allows the advancement Dune Blademaster → Dune Warmaster"
			{TRISTATE}
		[/choice]
#ifver WESNOTH_VERSION >= 1.16.0
		[choice]
			id=enable_great_ogre
			name=_"Enable Great Ogre"
			description=_"allows the advancement Ogre → Great Orgre"
			{TRISTATE}
		[/choice]
		[choice]
			id=enable_wose_shaman
			name=_"Enable Wose Shaman"
			description=_"allows the advancement Wose → Wose Shaman"
			{TRISTATE}
		[/choice]
		[choice]
			id=enable_death_squire
			name=_"Enable Death Squire"
			description=_"allows the advancement Skeleton → Death Knight"
			{TRISTATE}
		[/choice]
#endif
	[/options]

	[lua]
		code = <<
			for k, v in ipairs(...) do
				if wesnoth.get_variable(k) == "default"
					wesnoth.set_variable(k, v)
				endif
			end
		>>
		[args]
#ifdef ENABLE_ARMAGEDDON_DRAKE
			enable_armageddon_drake = "true"
#endif

#ifdef ENABLE_DWARVISH_ARCANISTER
			enable_dwarvish_arcanister = "true"
#endif

#ifdef ENABLE_DWARVISH_RUNESMITH
			enable_dwarvish_runesmith = "true"
#endif

#ifdef DISABLE_GRAND_MARSHAL
			enable_grand_marshal = "false"
#endif

#ifdef ENABLE_ANCIENT_LICH
			enable_ancient_lich = "true"
#endif

#ifdef ENABLE_DEATH_KNIGHT
			enable_death_knight = "true"
#endif

#ifdef ENABLE_TROLL_SHAMAN
			enable_troll_shaman = "true"
#endif

#ifdef ENABLE_WOLF_ADVANCEMENT
			enable_wolf_advancement = "true"
#endif

#ifdef ENABLE_NIGHTBLADE
			enable_nightblade = "true"
#endif

#ifdef ENABLE_WARMASTER
			enable_warmaster = "true"
#endif

#ifdef ENABLE_GREAT_OGRE
			enable_great_ogre = "true"
#endif

#ifdef ENABLE_WOSE_SHAMAN
			enable_wose_shaman = "true"
#endif

#ifdef ENABLE_DEATH_SQUIRE
			enable_death_shaman = "true"
#endif
		[/args]
	[/lua]

	[if]
		[variable]
			name = enable_armageddon_drake
			boolean_equals = yes
		[/variable]
		[then]
			[unit_type_fix]
				type = Inferno Drake
				set_experience = 220
				add_advancement = Armageddon Drake
			[/unit_type_fix]
		[/then]
	[/if]

	[if]
		[variable]
			name = enable_dwarvish_arcanister
			boolean_equals = yes
		[/variable]
		[then]
			[unit_type_fix]
				type = Dwarvish Runemaster
				set_experience = 210
				add_advancement = Dwarvish Arcanister
			[/unit_type_fix]
		[/then]
	[/if]

	[if]
		[variable]
			name = enable_dwarvish_runesmith
			boolean_equals = yes
		[/variable]
		[then]
			[unit_type_fix]
				type = Dwarvish Fighter
				add_advancement = Dwarvish Runesmith
			[/unit_type_fix]
		[/then]
	[/if]

	[if]
		[variable]
			name = enable_grand_marshal
			boolean_equals = false
		[/variable]
		[then]
			[unit_type_fix]
				type = General
				set_experience = 150
				remove_advancement = Grand Marshal
			[/unit_type_fix]
		[/then]
	[/if]

	[if]
		[variable]
			name = enable_ancient_lich
			boolean_equals = yes
		[/variable]
		[then]
			[unit_type_fix]
				type = Lich
				set_experience = 250
				add_advancement = Ancient Lich
			[/unit_type_fix]
		[/then]
	[/if]

	[if]
		[variable]
			name = enable_death_knight
			boolean_equals = yes
		[/variable]
		[then]
			[unit_type_fix]
				type = Revenant
				add_advancement = Death Knight
			[/unit_type_fix]
		[/then]
	[/if]

	[if]
		[variable]
			name = enable_troll_shaman
			boolean_equals = yes
		[/variable]
		[then]
			[unit_type_fix]
				type = Troll Whelp
				set_experience = Troll Shaman
			[/unit_type_fix]
		[/then]
	[/if]

	[if]
		[variable]
			name = enable_wolf_advancement
			boolean_equals = yes
		[/variable]
		[then]
			[unit_type_fix]
				type = Wolf
				set_experience = 30
				add_advancement = Great Wolf
			[/unit_type_fix]
			[unit_type_fix]
				type = Great Wolf
				set_experience = 65
				add_advancement = Direwolf
			[/unit_type_fix]
		[/then]
	[/if]

	[if]
		[variable]
			name = enable_nightblade
			boolean_equals = yes
		[/variable]
		[then]
			[unit_type_fix]
				type = Orcish Slayer
				set_experience = 100
				add_advancement = Orcish Nightblade
			[/unit_type_fix]
		[/then]
	[/if]

	[if]
		[variable]
			name = enable_warmaster
			boolean_equals = yes
		[/variable]
		[then]
			[unit_type_fix]
				type = Dune Blademaster
				set_experience = 150
				add_advancement = Dune Warmaster
			[/unit_type_fix]
		[/then]
	[/if]

	[if]
		[variable]
			name = enable_great_ogre
			boolean_equals = yes
		[/variable]
		[then]
			[unit_type_fix]
				type = Ogre
				set_experience = 80
				add_advancement = Great Ogre
			[/unit_type_fix]
		[/then]
	[/if]

	[if]
		[variable]
			name = enable_wose_shaman
			boolean_equals = yes
		[/variable]
		[then]
			[unit_type_fix]
				type = Wose
				add_advancement = Wose Shaman
			[/unit_type_fix]
		[/then]
	[/if]

	[if]
		[variable]
			name = enable_death_squire
			boolean_equals = yes
		[/variable]
		[then]
			[unit_type_fix]
				type = Skeleton
				add_advancement = Death Knight
			[/unit_type_fix]
		[/then]
	[/if]
[/modification]
@gfgtdf

This comment has been minimized.

Copy link
Contributor Author

commented Jun 1, 2019

The following code (supposed to get rid of [advance_from])

I'm quite sure that advancefrom also cannot do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.