Page 1 of 1

Monster attack...

Posted: Fri Oct 26, 2007 9:52 am
by Joramun
I was browsing some code to make a new monster, and it raised a few question :

:arrow: I don't understand where "halfranged" and "threefourthranged" are used in the code.
It seems to me the monster just uses on_attack_ranged and on_attack_close
And decides to use a missile close in depending only on "prefer_ranged".

In fact, there seem to be no use of "should_attack_ranged", and also the code to determine the use of ranged attack close up is a bit arbitrary :
If prefer_ranged is true, the monster has 3/4th chance to attack ranged at close range.
If it is nil, the monster has 1/4th to do it IF it has a ranged attack available.

That's a bit of a personal opinion, but I would have done things another way :
- should_attack_ranged, would determine if the monster use a ranged attack when at close range.
- prefer_ranged would be checked when determining movement, to see if the monster would rather close in toward the party, or stay at a shoot distance...
- I would have used an integer to determine the prefered range of a monster attack. A monster would always try to stay at given distance for his attack. That would allow for sniper monsters etc.

:arrow: Also, I think there was (somewhere in some version) a prefer_back_row item...
Maybe I'm wrong but in any case, it raises a question :
Is there any difference in combat whether the monster is on the front or back row ?
I didn't see one, but I might be wrong (and hope I'm wrong, it would be cool to have such a difference)...

:arrow: Would it be very difficult to separate power, damage and delta for missiles ?
[For dsb beginners : power affects the range, damage is obvious, and delta is the value by which power and damage are decreased at each step of flight -- the missiles fall/disappear when power or damage < 0 ]
(adding "power_delta" and "damage_delta" instead of just "delta" to the dsb_shoot function ...)
It would allow :
- to make a missile that loose no damage but goes very far.
- a missile with very low range and high power in any case.
- any other configuration [even a missile that grows in power with range!]

It seems it can be an innocuous change (accepting the last parameter "damage_delta" to be nil, and in that case set it internally to be equal to "power_delta")

EDIT : also, considering wounds zones, is it possible to set a monster to deal multiple wounds ?

Posted: Fri Oct 26, 2007 10:06 pm
by Sophia
Joramund wrote:I don't understand where "halfranged" and "threefourthranged" are used in the code.
It seems to me the monster just uses on_attack_ranged and on_attack_close
And decides to use a missile close in depending only on "prefer_ranged".
halfranged and threefourthranged are values for should_attack_ranged. You won't see a call to it because it's invoked by the core engine, not by anything in Lua. (That violates the informal rule I've tried to keep that all engine calls start with on_ or sys_, but it's not really an event or a system function, so I had trouble with this one-- if you can suggest a better name, feel free)

Anyway, should_attack_ranged determines whether the monster will advance or launch a ranged attack. prefer_ranged determines whether the monster tends to attack with its ranged attacks even when standing in melee range. So, it's actually similar to what you would've done, just with the two variables reversed. :)
Joramund wrote:Also, I think there was (somewhere in some version) a prefer_back_row item...
Maybe I'm wrong but in any case, it raises a question :
Is there any difference in combat whether the monster is on the front or back row ?
No, that was something I was researching in CSBwin. There's no such thing in DSB. Maybe there should be.... ;)
Right now there's no difference. Again, maybe there should be. ;)
Joramund wrote:adding "power_delta" and "damage_delta" instead of just "delta" to the dsb_shoot function .
No problem. I'll add this.
Joramund wrote:considering wounds zones, is it possible to set a monster to deal multiple wounds
Not in the base code, but there's nothing stopping you from creating your own monster attack type and causing that to happen. ;)