Displaying weapon special damage modification

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
Kwandulin
Art Contributor
Posts: 362
Joined: March 30th, 2014, 7:35 am
Location: Germany

Displaying weapon special damage modification

Post by Kwandulin »

Hello guys,

i am currently working on a small campaign and i make use of the following weapon special that deals additional damage to trolls (and works as intended):

Code: Select all

#define WEAPON_SPECIAL_TROLLSLAYER
	[damage]
		id=trollslayer_attack
		name= _ "Trollslayer"
		description= _ "Trollslayer: This attack deals an additional +25% damage to trolls"
		[filter_defender]
			race=troll
		[/filter_defender]
		multiply=1.25
		apply_to=self
	[/damage]
#enddef
The problem is the following: Whenever it is the player's turn, the already increased damage is shown in the right column of the interface. Since the increased damage only works on trolls, the unit's damage that is displayed may easily confuse the player, if the unit attacks any other non-troll unit and deals less damage than roughly expected (Currently the interface shows: the unit's attacks are weaker if it attacks a non-troll unit. I want: the unit's attacks are stronger if it attacks a troll-unit.).
trollslayer.png
So, is there a (simple) way to show the non-modificated damage in the right column of the interface?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Displaying weapon special damage modification

Post by zookeeper »

Sounds like a bug. I don't think I've ever had to deal with that before, so I can't really tell off the top of my head what workarounds there could be. What I would try is to add some kind of extra filter types and see if any of them cause the behavior to be flipped. Or maybe you could make the current [damage] filterless, and add another one which drops the damage back to normal against non-trolls; I'd expect the game to display the latter then.

P.S. Are you sure you're just not seeing the effects of the ToD bonus?
User avatar
Kwandulin
Art Contributor
Posts: 362
Joined: March 30th, 2014, 7:35 am
Location: Germany

Re: Displaying weapon special damage modification

Post by Kwandulin »

I tried your second suggestion and it does work as intended now (ToD hadn't affected the unit as it was a neutral one). Thanks for the impulse!

Here is the code, if anybody is interested:

Code: Select all

#define WEAPON_SPECIAL_TROLLSLAYER
	[damage]
		id=trollslayer_attack
		name= _ "Trollslayer"
		description= _ "Trollslayer: This attack deals an additional +25% damage to trolls"
		[filter_opponent]
			#race=troll
		[/filter_opponent]
		multiply=1.25
		apply_to=self
	[/damage]
	[damage]
		name=
		description=
		[filter_opponent]
			[not]
				race=troll
			[/not]
		[/filter_opponent]
		divide=1.25
		apply_to=self
	[/damage]
#enddef
Last edited by Kwandulin on September 1st, 2014, 4:26 am, edited 1 time in total.
User avatar
Ravana
Forum Moderator
Posts: 3008
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Displaying weapon special damage modification

Post by Ravana »

Wouldnt this way manipulate actual damage? So 1.25 to trolls and 0.8 to others.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Displaying weapon special damage modification

Post by gfgtdf »

this is a known behaviour change in 1.11.x
here is some comment about it in the code : https://github.com/wesnoth/wesnoth/blob ... s.cpp#L791.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
Kwandulin
Art Contributor
Posts: 362
Joined: March 30th, 2014, 7:35 am
Location: Germany

Re: Displaying weapon special damage modification

Post by Kwandulin »

@Ravana: Oh, yeah, you are right. My fault. The line race=troll in the first [filter_opponent] has to be crossed out. I fix'd it in the upper comment.

@gfgtdf: Thanks for the clarification
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: Displaying weapon special damage modification

Post by ChaosRider »

Here you got working special (from Random Colosseum), change special id (dwarves_tamer for your own), name, description, race for trolls race and multiply value (this with 1.5, other one is to make this special seeable all the time :]).
Spoiler:
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Displaying weapon special damage modification

Post by zookeeper »

gfgtdf wrote:this is a known behaviour change in 1.11.x
here is some comment about it in the code : https://github.com/wesnoth/wesnoth/blob ... s.cpp#L791.
I wonder what the exact rationale for that was, though, aside from what the comment mentions. It does result in the "wrong" behavior in cases like this, after all.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Displaying weapon special damage modification

Post by gfgtdf »

zookeeper wrote:
gfgtdf wrote:this is a known behaviour change in 1.11.x
here is some comment about it in the code : https://github.com/wesnoth/wesnoth/blob ... s.cpp#L791.
I wonder what the exact rationale for that was, though, aside from what the comment mentions. It does result in the "wrong" behavior in cases like this, after all.
idk, maybe jamit knows more about this since he is the one who wrote that comment.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Post Reply