During playtesting I've found message in a game journal:
Dead cave troll has struck you for 457 physical damage.
Wtf? There is no way dead troll can hit anyone, he is dead,
and there is no necromancy in my game.
Checked conditions on actions - conditions are fine!
Dead troll can't attack...
After observing attacks of dead for a while, I've
found that only mobs under specific spell effect tend to do so.
And that effect is 'damage dealt by affected unit
is returned to him as fire damage'.
So during damage processing damage was returned and killed troll,
and a little later message about damage by troll was added.
I cannot postpone returned damage, since whole thing can be
cancelled, avoided, reduced etc.
Theoretically situation is possible:
At the very moment troll's claws touch player,
spell burns troll to death, but he still deal
damage to player even though he was dead by than.
But it looks somewhat strange, from player's point of view.
Especially if monster's attack have some side effects.
Like poison.
Don't know what to do with this...
> Theoretically situation is possible:
> At the very moment troll's claws touch player,
> spell burns troll to death, but he still deal
> damage to player even though he was dead by than.
>
> But it looks somewhat strange, from player's point of view.
> Especially if monster's attack have some side effects.
> Like poison.
>
> Don't know what to do with this...
if it is only one situation, you could always hack it in some fashion,
perhaps simply by changing the message if the troll is dead, to
something more understandable, for example:
"Dead troll's fire shield struck for 457 damage."
- Gerry Quinn
"Dieing cave troll has struck you for 457 physical damage."
So he basically struck you as his last action.
Jotaf
Change "dead" to "dying".
"Dying cave troll has struck you for 457 physical damage."
The player shouldn't be confused by such a message, and it sounds
like it is a fairly accurate description of what is happening.
"Dead cave troll got the last laugh in his death throes and had struck
you for 457 physical damage."
"Dead cave troll had struck you for 457 physical damage as its final
act."
The importance of "has -> had" can not be understated when speaking of
dead things.
> During playtesting I've found message in a game journal:
> Dead cave troll has struck you for 457 physical damage.
> After observing attacks of dead for a while, I've
> found that only mobs under specific spell effect tend to do so.
> And that effect is 'damage dealt by affected unit
> is returned to him as fire damage'.
> So during damage processing damage was returned and killed troll,
> and a little later message about damage by troll was added.
>
> I cannot postpone returned damage, since whole thing can be
> cancelled, avoided, reduced etc.
> Don't know what to do with this...
The 'right' way to fix it:
1) Remove the status adjective 'dead' from the original message.
2) Generate a message during damage processing whenever fire shields
kill something.
3) Make sure the new message gets into the message queue after
the message about the damage the monster did.
A hack that'll probably be easier, especially if your language
has built-in regexes:
Postprocess the message queue before displaying it and replace
any "The dead $FOO hits you for $BAR damage" messages with "The
$FOO hits you for $BAR damage. Your fire shield kills the $FOO!"
Either way, the player sees:
"The Cave Troll hits you for 457 physical damage!"
"Your fire shield kills the Cave troll!"
Bear
Later on it will call source->getName() and it will return 'dead cave
troll'.
> 2) Generate a message during damage processing whenever fire shields
> kill something.
I can't. There is only call to 'receiveDamage' method.
This method will generate message about troll being killed by player.
> 3) Make sure the new message gets into the message queue after
> the message about the damage the monster did.
Right now scheme of receiveDamage method looks like this:
for each item in damageInfo
perk related damage changes
if chance to miss when possible then next item
if source have effect cursed fire then
1 source->receiveDamage from target
2 if chance to block when possible then next item
3 on damage receive events (can cancel damage)
4 if damage cancelled next item
on damage deal events (can change damage)
target specific damage preprocessing
5 resistancies are applied if fully resisted next item
6 generate 'deal damage event'
decrease target hp if hp<0 kill target
7 process returned and splash damage
end
There is a normal returned damage and it's processed at point 7 and
everything is fine with it.
But by design cursed fire should be applied before damage can be avoided
and/or changed at points 2,3,4,5. The only way to do so, is to deal it
at point 1. But than we have discussed effect.
Hm...
I can create scoped guard. Make copy of a damage item at point 1,
and apply it in a destructor.
Sometimes while you are trying to make a detailed description of the
problem, solution can come to your mind :)
> Ray wrote:
>> The 'right' way to fix it:
>> 1) Remove the status adjective 'dead' from the original message.
> I can't simply remove it. Already dead creature can kill player with
> 'damage over time' effect.
> And message isn't formatted right there.
> It looks like this:
> el.addEvent(new DealDamageEvent(source,this,di));
> Later on it will call source->getName() and it will return 'dead cave
> troll'.
All I can say is that if the troll is alive when it deals the damage,
and your message says a dead troll is dealing the damage, then either
the call that generates that message is being processed at the wrong
instant, or your code is making things (like the troll's death) happen
out of order.
If it's the first, you can move the message-generating call earlier
in the process and just store the generated string until you need to
display it.
If it's the second, you need to fix the way you process events, because
any mistakes in time resolution will keep generating a steady stream of
bugs forever.
>> 2) Generate a message during damage processing whenever fire shields
>> kill something.
> I can't. There is only call to 'receiveDamage' method.
> This method will generate message about troll being killed by player.
I don't see a serious problem there. You could embellish it a bit and
say *how* someone kills the troll if you like extra clarity, but seriously
it's okay. If the message about killing the troll comes after the message
about the troll doing damage, then it works. The only problem is to avoid
calling it a "dead" troll in messages that come before the message about
killing it!
> Right now scheme of receiveDamage method looks like this:
>
>
> for each item in damageInfo
> perk related damage changes
> if chance to miss when possible then next item
> if source have effect cursed fire then
> 1 source->receiveDamage from target
> 2 if chance to block when possible then next item
> 3 on damage receive events (can cancel damage)
> 4 if damage cancelled next item
> on damage deal events (can change damage)
> target specific damage preprocessing
> 5 resistancies are applied if fully resisted next item
> 6 generate 'deal damage event'
> decrease target hp if hp<0 kill target
> 7 process returned and splash damage
> end
>
> There is a normal returned damage and it's processed at point 7 and
> everything is fine with it.
> But by design cursed fire should be applied before damage can be avoided
> and/or changed at points 2,3,4,5. The only way to do so, is to deal it
> at point 1. But than we have discussed effect.
> Hm...
Somewhere in your code there is a list of all the damage events
happening on a particular turn? The one you mention when you say
'for each item in DamageInfo'?
In that case here is a good solution. Instead of making a recursive
call at point 1, create a new item for the cursed-fire damage event
and push it onto the front of the list where it will be processed
next.
Then you can handle cursed-fire damage the same way as other damage -
although chances to block or cancel will be zero and you probably
want to avoid having cursed-fire damage result in more cursed-fire
damage if two mobs that both have the effect are fighting each other.
> I can create scoped guard. Make copy of a damage item at point 1,
> and apply it in a destructor.
> Sometimes while you are trying to make a detailed description of the
> problem, solution can come to your mind :)
Hey, that could work too. If you've gotten unblocked by
talking/thinking about it, good for you!
Bear
No. Players and monsters can deal multiple types of damage
with one blow. Player can wield orb of fire in one hand
and orb of lightning in other and deal both types of damage
with each attack. The same goes for multielement spells.
>> I can create scoped guard. Make copy of a damage item at point 1,
>> and apply it in a destructor.
>> Sometimes while you are trying to make a detailed description of the
>> problem, solution can come to your mind :)
>
> Hey, that could work too. If you've gotten unblocked by
> talking/thinking about it, good for you!
This works surprisingly often :)