Modification can affect resistances & movement consts

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Post Reply
joshudson
Posts: 501
Joined: January 17th, 2006, 8:04 pm
Contact:

Modification can affect resistances & movement consts

Post by joshudson »

See "Wose Traits": http://www.wesnoth.org/forum/viewtopic.php?t=11010
These threads are linked by nature.

Analysis for patch:
in unit.cpp:add_modification, merge the [movement_costs] and [defense] subelements into cfg_

I hope to have a working patch soon, but just in case I don't, this will allow the next person to get a warm start.

My complements on your design.
joshudson
Posts: 501
Joined: January 17th, 2006, 8:04 pm
Contact:

Post by joshudson »

First patch. Allows for set new evasions, resistances, and movesment_costs.

Included a test campaign. Note the pre-existing wose has three weird traits.
Costs 2 mp to move in forest
80% blade resistance
60% evasion in forest

Enjoy :)
Attachments
wesnothpatch1.txt
[movetype] trait, version 1
(602 Bytes) Downloaded 371 times
test.zip
Test campaign
(1.79 KiB) Downloaded 338 times
Xan
Inactive Developer
Posts: 258
Joined: August 28th, 2005, 3:05 pm
Contact:

Post by Xan »

Segmentation Fault



* * *


It is possible for config::child("foo") to return NULL.
"It is time people learned about their failures and my successes."
Xan
Inactive Developer
Posts: 258
Joined: August 28th, 2005, 3:05 pm
Contact:

Post by Xan »

Oh, and only allowing setting the values is really restrictive.

Most modifications can also be removed.
"It is time people learned about their failures and my successes."
joshudson
Posts: 501
Joined: January 17th, 2006, 8:04 pm
Contact:

Post by joshudson »

Hmm, you're right. Remove doesn't actually work. I'll see what I can do.
I've been thinking about deltas myself.
joshudson
Posts: 501
Joined: January 17th, 2006, 8:04 pm
Contact:

Post by joshudson »

Changed the patch to use deltas instead of new constants.
Couldn't do both. For some reason, the parser converts "+1" to "1".
Removal of modifications works.
Attachments
wesnothpatch2.txt
Patch (version 2)
(3.51 KiB) Downloaded 384 times
test.zip
New test scenario.
(1.72 KiB) Downloaded 340 times
joshudson
Posts: 501
Joined: January 17th, 2006, 8:04 pm
Contact:

Post by joshudson »

Grrr. Removal of modifications worked with the "set" method, but not with the "delta" method.
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

You could use two different tags, one for setting and one for modding.
joshudson
Posts: 501
Joined: January 17th, 2006, 8:04 pm
Contact:

Post by joshudson »

Excellent solution. And hey, that fixed the removal code (at least I think it did).
Syntax invented (I hope this posts right):

[trait]
id=hardy
name= _ "Hardy"
description = "Blade Resistant"
[effect]
apply_to=resistance
[resistance]
blade=-40
[/resistance]
[/effect]
[/trait]
[trait]
id=treeish
name = _ "Tree-ish"
description = "Hard to hit in forest"
[effect]
apply_to=defense
replace=yes
[defense]
forest=50
[/defense]
[/effect]
[/trait]

Particularly, notice "replace=yes" near the bottom. It defaults to no. If
set, the old value is discarded. If cleared, the value is added. Be
careful, to add resistances or defense, you must subtract (the
same is true everywhere else these values are visible in WML).

Patch, Take 3.
Attachments
test.zip
Test for patch version 3
(1.73 KiB) Downloaded 320 times
wesnothpatch3.txt
Patch version 3
(3.78 KiB) Downloaded 375 times
joshudson
Posts: 501
Joined: January 17th, 2006, 8:04 pm
Contact:

Post by joshudson »

Patch is now on patches.wesnoth.org. https://gna.org/patch/index.php?func=de ... tem_id=541
joshudson
Posts: 501
Joined: January 17th, 2006, 8:04 pm
Contact:

Post by joshudson »

Update: XAN committed a slightly modified version of the patch.
CHKDSK has repaired bad sectors in CHKDSK.EXE
Post Reply