I am trying to create a potion with a 1 time use that has the following effect. Upon consumption, the character permanently has the following ability: Whenever they hit something, their APR increases by 1/2 for 30s. It is a kind of Frenzy or Blood Lust triggered by a successful melee attack. But I am not having any luck implementing this.
The potion itself seems fine. It casts a spell on the consumer. The spell has one instant/permanent, no dispel, 100% probability effect using opcode 248 and referencing an effect file. Though I am not sure whether I have correctly set the target for this spell effect. I have tried different targets to no avail.
For the effect file, I have tried making it two ways. The first way was a straightforward effect that implements an increment of 1/2 to the APR, targeted to Self with instant/limited duration of 30s.
That didn't work, so I tried the convoluted idea of using the effect to cast a spell (opcode 146), targeted at self. The spell then implements the APR increment. That didn't work either.
Is what I am trying possible? The opcodes page at iesdp states that the effect of opcode 248 will be applied to the target (and therefore not the attacker). So perhaps with this opcode, the engine ignores the targets and simply uses the target of the melee attack. Or, am I just missing the correct combination of target values for all these headers?
One other idea: My effect file targets the actual target of the melee hit and uses opcode 232 (to place a contingency on the target). That contingency uses condition 0 (HitBy()) and uses that to have the target of the melee hit cast the increase of APR back at the attacker. But it seems that then the effect would only apply to subsequent hits because the first hit would only set up the contingency (which could then be triggered by someone else hitting the target and getting the APR boost). So that doesn't seem very good.
Has anyone tried something like this before?