rpherbig / dr-scripts

A series of Lich 5 (https://github.com/elanthia-online/lich-5) scripts for use with DragonRealms (http://www.play.net/dr/). Donations are welcome (http://www.paypal.me/rcuhljr)!
GNU General Public License v2.0
52 stars 177 forks source link

Manipulate issue #1838

Closed blaylosw closed 7 years ago

blaylosw commented 7 years ago

It seems that combat-trainer has an issue with manipulate friendship, when there is more than one type of mob in the hunting area. It then hangs for a minute or so,

Arrtemis.txt Here is an example

[combat-trainer]>manipulate friendship second tightwad Manipulate what?

rpherbig commented 7 years ago

[combat-trainer]>perc heal

You are still stunned.

[combat-trainer]>perc heal

You are still stunned.

[combat-trainer]>perc heal

A pugnacious pinchfist appears less distracted.
A miserly moneygrubber thrusts a brass-inlaid cane at a pugnacious pinchfist.  A pugnacious pinchfist dodges, ducking in the nick of time.  
* Moving well, a miserly moneygrubber sidesteps and bashes at you.  You attempt to dodge.  The cane lands a brushing hit to your back.
[You're very badly balanced with opponent overwhelming you.]
You close your eyes, drawing all your thoughts inward, and then slowly reach out to sense the life essences of those around you...

You sense:
    Several relatively healthy presences nearby.
Roundtime: 8 seconds
A pugnacious pinchfist feints to the side at a miserly moneygrubber.  A miserly moneygrubber evades, just stepping out of harm's way.  
The troublesome tightwad begins to advance on you!
The troublesome tightwad advances from nearby and is closing steadily.
* A shifty-eyed skinflint thrusts a jet-inlaid cane at you.  You counter little of the cane with a steel throwing spike with a tempered blade.  
[You're very badly balanced with opponent overwhelming you.]
You feel fully prepared to cast your spell.
The troublesome tightwad closes to melee range on you!

I don't see any manipulates in that log. Could you clarify what you saw?

blaylosw commented 7 years ago
[combat-trainer]>manip stop all
You relax your will, ending your empathic manipulations.

A pugnacious pinchfist moves about dazedly for a bit, before seeming to focus on possible threats again.

A miserly moneygrubber moves about dazedly for a bit, before seeming to focus on possible threats again.
>
[combat-trainer]>manipulate friendship first pinchfist
You attempt to empathically manipulate a pugnacious pinchfist's feelings towards you to be those of a friend.
You extend your will and empathically manipulate a pugnacious pinchfist to consider you friend, not foe.
Roundtime: 9 seconds
>
You feel fully rested.
>
The pugnacious pinchfist begins to advance on a miserly moneygrubber.
>
A miserly moneygrubber counts his paces backward, as if every step will cost him.
Jingling the coins in his pouch, a miserly moneygrubber saunters west.
>
The troublesome tightwad moves into a position to parry.
>
The pugnacious pinchfist closes to melee range on a miserly moneygrubber.
>
A shifty-eyed skinflint snaps a copper coin at you!
You block the skinflint's copper coin with your round sipar.
The copper coin bounces away and disappears.
[You're nimbly balanced with opponent dominating.]
>
* A troublesome tightwad thrusts a bone-inlaid cane at you.  You repulse little of the cane with a steel throwing spike with a tempered blade.  
[You're nimbly balanced with opponent in better position.]
>
[combat-trainer]>manipulate friendship second moneygrubber
Manipulate what?
>
A miserly moneygrubber appears less distracted.
>
* Moving well, a pugnacious pinchfist thrusts a pewter-inlaid cane at you.  You beat off little of the cane with a steel throwing spike with a tempered blade.  
[You're nimbly balanced and opponent has slight advantage.]
>
With strength, a pugnacious pinchfist lunges a pewter-inlaid cane at a miserly moneygrubber.  A miserly moneygrubber fails to evade.  The cane lands a light hit to its back!  
>
The air around you solidifies into a pale yellow haze and throws off bright waves of light as it resists the attack.
* Moving with great skill, a troublesome tightwad sweeps low at you.  You badly fail to parry with a steel throwing spike with a tempered blade.  The cane lands a harmless blow to your left leg.
[You're nimbly balanced with opponent in strong position.]
>
A miserly moneygrubber turns to face a pugnacious pinchfist.
A miserly moneygrubber thrusts a brass-inlaid cane at a pugnacious pinchfist.  A pugnacious pinchfist deflects little of the cane with a pewter-inlaid cane.  
>
The air around you solidifies into a pale yellow haze and throws off shimmering light in the wake of the attack.
* Moving well, a shifty-eyed skinflint sweeps low at you.  You attempt to dodge.  The cane lands a skimming strike to your right arm.
[You're nimbly balanced with opponent in excellent position.]
>
* A pugnacious pinchfist sweeps low at you.  You evade, barely twisting out of a tight spot.  
[You're nimbly balanced with opponent in strong position.]
>
The pugnacious pinchfist moves into a position to parry.
>
[combat-trainer: *** No match was found after 15 seconds, dumping info]
[combat-trainer: messages seen length: 23]
[combat-trainer: message: Manipulate what?]
[combat-trainer: message: A miserly moneygrubber appears less distracted.]
[combat-trainer: message: * Moving well, a pugnacious pinchfist thrusts a pewter-inlaid cane at you.  You beat off little of the cane with a steel throwing spike with a tempered blade.  ]
[combat-trainer: message: [You're nimbly balanced and opponent has slight advantage.]]
[combat-trainer: message: With strength, a pugnacious pinchfist lunges a pewter-inlaid cane at a miserly moneygrubber.  A miserly moneygrubber fails to evade.  The cane lands a light hit to its back!  ]
[combat-trainer: message: The air around you solidifies into a pale yellow haze and throws off bright waves of light as it resists the attack.]
[combat-trainer: message: * Moving with great skill, a troublesome tightwad sweeps low at you.  You badly fail to parry with a steel throwing spike with a tempered blade.  The cane lands a harmless blow to your left leg.]
[combat-trainer: message: [You're nimbly balanced with opponent in strong position.]]
[combat-trainer: message: Aggressive Stance  (Fading)]
[combat-trainer: message: Manifest Force  (19 roisaen)]
[combat-trainer: message: Blood Staunching  (23 roisaen)]
[combat-trainer: message: Iron Constitution  (21 roisaen)]
[combat-trainer: message: Mental Focus  (20 roisaen)]
[combat-trainer: message: Gift of Life  (Fading)]
[combat-trainer: message: Refresh  (18 roisaen)]
[combat-trainer: message: A miserly moneygrubber turns to face a pugnacious pinchfist.]
[combat-trainer: message: A miserly moneygrubber thrusts a brass-inlaid cane at a pugnacious pinchfist.  A pugnacious pinchfist deflects little of the cane with a pewter-inlaid cane.  ]
[combat-trainer: message: The air around you solidifies into a pale yellow haze and throws off shimmering light in the wake of the attack.]
[combat-trainer: message: * Moving well, a shifty-eyed skinflint sweeps low at you.  You attempt to dodge.  The cane lands a skimming strike to your right arm.]
[combat-trainer: message: [You're nimbly balanced with opponent in excellent position.]]
[combat-trainer: message: * A pugnacious pinchfist sweeps low at you.  You evade, barely twisting out of a tight spot.  ]
[combat-trainer: message: [You're nimbly balanced with opponent in strong position.]]
[combat-trainer: message: The pugnacious pinchfist moves into a position to parry.]
[combat-trainer: checked against [/You're already manipulating/i, /beyond your ken/i, /You attempt to empathically manipulate/i, /You strain/i]]
[combat-trainer]>stance set 100 81 0
>
The troublesome tightwad moves into a position to parry.
>
Setting your Evasion stance to 100%, your Parry stance to 81%, and your Shield stance to 0%.  You have 0 stance points left.
>
[combat-trainer]>pre mef 5
With tense movements you prepare your body for the Mental Focus spell.
blaylosw commented 7 years ago

So what is doing for some reason is targeting with manipulate a second mob of the same type when there isnt a second mob to manipulate. Happens when there is different mobs in the same room

rpherbig commented 7 years ago

Ok, I think I see the problem. Combat-trainer assumes that only one mob noun will be in the room - it manipulates based on NPC name and index. So if you have ['A', 'B'] in the room, it'll manipulate first A and second B.

It should really track ordinal for each unique mob noun, which shouldn't be too hard to fix. I just don't have an empath with which to test any such fix...

blaylosw commented 7 years ago

going to be out for most of today, but can I help tomorrow?

rpherbig commented 7 years ago

I think this will fix it. Replace the entire @filtered_npcs.each_with_index loop with this:

npc_occurrences = Hash.new(0)
@filtered_npcs.each do |npc|
    break if manipulate_count >= @threshold

    index = npc_occurrences[npc]
    ordinal_string = $ORDINALS[index]

    bput("manipulate friendship #{ordinal_string} #{npc}", 'You\'re already manipulating', 'beyond your ken', 'You attempt to empathically manipulate', 'You strain')
    manipulate_count += 1
    npc_occurrences[npc] += 1
end
blaylosw commented 7 years ago

I made a copy of combat-trainer and inserted the code. It looks to be working fine, tested it three different times. Thank you