New Content - Implemented PVP Revamp

lostcalpolydude

Developer
Staff member
I had been thinking about that recently. It would also mean another setting (off by default?) to decide whether to run your mood while using pvp fights.
 

Donavin69

Member
I'd rather let the computer figure that out for me

I agree, but it isn't that big of a deal for me...I set my mood, then use the same number of server hits a 'mood' would (I just click on the 'up buff' in the relay browser the appropriate number of times)

decide whether to run your mood while using pvp fights.

I decide YES, run my mood ;)

So, in summary, I'd love to see this option, but, since I haven't been helping with the mafia coding, I won't ask for it...
 
Last edited:

roippi

Developer
I had been thinking about that recently. It would also mean another setting (off by default?) to decide whether to run your mood while using pvp fights.

I don't necessarily see why a separate preference is needed. PVP burns turns of buffs just like an adventure, I think we should treat it just like adventuring.
 

Bale

Minion
I don't necessarily see why a separate preference is needed. PVP burns turns of buffs just like an adventure, I think we should treat it just like adventuring.

NO NO NO NO!

That would be very bad for me. When I'm in hardcore and using PvP to burn off the last 10 turns of "On the Trail" it might also burn off my last 2 turns of "Leash of Linguinini". If it immediately recast Leash, then it would waste 8 turns of the buff while I was PvPing. I'd much rather cast Leash when I'm done with PvP.

Obviously this would mean I'd need to work-around this by setting my mood to apathetic while PvPing to prevent that. However it would be much too easy to forget to turn off my mood whenever I PvP in hardcore and then turn it back on again.

Please don't do this to me.
 

roippi

Developer
NO NO NO NO!

That would be very bad for me. When I'm in hardcore and using PvP to burn off the last 10 turns of "On the Trail" it might also burn off my last 2 turns of "Leash of Linguinini". If it immediately recast Leash, then it would waste 8 turns of the buff while I was PvPing. I'd much rather cast Leash when I'm done with PvP.

Obviously this would mean I'd need to work-around this by setting my mood to apathetic while PvPing to prevent that. However it would be much too easy to forget to turn off my mood whenever I PvP in hardcore and then turn it back on again.

Please don't do this to me.

That's pretty niche, Bale. But I suppose we can just not apply moods when !can_interact.

I'm resisting Yet Another Checkbox here.
 

lostcalpolydude

Developer
Staff member
I think I would prefer never running moods while executing pvp fights over running moods without a separate setting.
 

lostcalpolydude

Developer
Staff member
Considering that my active mood would probably be for castle farming (too lazy for now to find something better) and it would shrug the AT buffs I apply for pvp, it really would be detrimental if I forget to actively do something with my mood setup.
 

slyz

Developer
People will probably want to change the behavior, sometimes wanting mood maintenance, sometimes not.

I think the most intuitive way to do this is to have Mafia always maintain your mood like if you were adventuring. Instead of switching the behavior by looking for a checkbox in Preferences, you would simply need to set your mood to apathetic.
 

roippi

Developer
I find adventuring and PVP almost entirely indistinguishable. PVP just pulls from its own special pile of turns.

I can see the argument for not executing moods in-ronin, though: you're never going to care about winning, you might care about MP expenditure.
 

lostcalpolydude

Developer
Staff member
I suppose what I really want is a separate mood to run during pvp, rather than the same one that's active while adventuring and is mostly guaranteed to be useless for pvp. That seems more complicated to have automatically happen though.
 

Veracity

Developer
Staff member
I like that too.

We have a variety of approaches, though. I disagree with roippi's assessment that "in-run you will never care about wins". Since my one and only reason for PVPing, at the moment, is accumulating swagger so I can get swag, I care about winning all the time. Yes, I get 1 swagger even if I lose, but winning and getting 2 is twice as good. So I try to win, even in-run.

Even so, I don't want a "PVP mood" in my (HC) runs, since I have a lot more manual decisions to make about what effects I will want for how long for any particular day on the run. I will use potions, for example, to increase my odds of winning, but which ones and how many will depend on my resources. Unlike Bale, I am completely uninterested in using PVP just to burn off turns of effects.

In aftercore, I don't have to worry about resources: I know what effects I want and I just want to make sure that they are up whenever I initiate a fite. I'd also like it if KoLmafia didn't decide to execute my PVP mood if I happen to click on an adventure location.

But, people could differ about how they want a PVP mood to work, too. I want my effects to be active after I have completed all the fites that I will initiate, to make it more likely that I win when people attack me over the course of the rest of the day. That preserves my current Fame and Winningness - neither of which is anything more than a Leaderboard, at the moment; the Fame mini measures how much you have won, I think, not what your current Fame is. So, people might reasonably be willing to let their expensive effects just run down on their last fite of the day.

Perhaps the solution is to have a "before PVP script" which executes before KoLmafia submits a URL to initiate a fite, either automated or in the Relay Browser. I would probably just set mine to something like:

mood pvp
mood execute

but people could write as complicated an ASH script as they wanted to look at fites remaining, turns remaining of effects, availability of once-per-day buffs, and so on.
 

slyz

Developer
Or maybe we can execute a mood when you are pvp-ing only if it contains "pvp" in the name? Or is that not simple/clear enough?
 

Veracity

Developer
Staff member
Revision 11111 adds (some) support for the beforePVPScript and relayRunsBeforePVPScript settings. I have not tried it, yet, but it should call your beforePVPScript before submitting peevpee.php?action=attack in the Relay Browser. I did not add support for the automated version, yet, since I'm not yet ready to actually try that one out, since it uses all your remaining fites, and I need to make my script do what I need for that case. If someone wants to try it, adding the following line:

Code:
			KoLmafia.executeBeforePVPScript();

to the appropriate place in PvpManager.executePvpRequest() will probably suffice.

I added pvp_attacks_remaining() to ASH. This is only guaranteed accurate if you have visited the Fight! page recently. That will be the case in PvpManager.executePvpRequest() and in the Relay Browser.

It would be nice to track PVP Fights gained from consumption or the Goth Kid, presumably by modifying the ResultProcessor to detect them. But we also need to get PVP Fights left at login, and it's not in api.php, yet, near as I can tell. I submitted a bug report asking for that.
 

Veracity

Developer
Staff member
Not that I have had a chance to test it yet, but the following looks promising:

Code:
if ( !can_interact() )
    exit;

int attacks = pvp_attacks_left();

if ( attacks == 0 )
    exit;

string PVPoutfit = "PVP fights";

if ( have_outfit( PVPoutfit) && !is_wearing_outfit( PVPoutfit ) )
    outfit( PVPoutfit );

boolean [ effect ] PVPeffects = $effects[
    ... your effects here ...
];

int keep = 0;

foreach eff in PVPeffects {
    int left = have_effect( eff );
    if ( left <= keep ) {
	print( "Effect: " + eff + " has only " + left + " turns remaining" );
	cli_execute( "up " + eff );
    }
}

if ( attacks <= ( 10 - keep ) && have_effect( $effect[ Starry Eyed ] ) == 0 )
    cli_execute( "telescope look high" );

... any other one-per-day effects here ...
I want "keep = 1" and have a specific list of effects I want to maintain and have various other limited-per-day things I want to do, but I like this. No mood needed.

We'll see how it works tomorrow.
 
Last edited:

lostcalpolydude

Developer
Staff member
It would be nice to track PVP Fights gained from consumption or the Goth Kid, presumably by modifying the ResultProcessor to detect them. But we also need to get PVP Fights left at login, and it's not in api.php, yet, near as I can tell. I submitted a bug report asking for that.

It would be possible to check exactly once per session the way things are now, but having it in api.php would be better of course.

I attached the patch that I have working for recognizing pvp fights gained from the goth kid and consumption. I didn't add it yet because I wasn't sure if there's a better way of doing it, especially with the various PRIORITY options to choose from.
 

Attachments

  • pvpFightsTracking.patch
    2 KB · Views: 26

Veracity

Developer
Staff member
I think the purpose of the PRIORITY is to allow you to distinguish what the AdventureResult is by simply comparing the priority field to the integer constant. On the other hand, you can use a string constant for the name and compare with that, just as you are doing. That works too, since the only time you create "PvP" AdventureResult, you use that exact string constant as the name.

I don't feel strongly about using one technique over the other for things that only can HAVE one name. I also don't understand why "Still" or "Pull", for example, have ADV_PRIORITY.

I think your approach is fine.
 

Bale

Minion
I thoroughly approve of this solution. Thank you Veracity. This'll be nice for keeping Trivia Master (and various other things) active while PvPing in aftercore. I particularly like the auto telescope idea since I always seem to forget about it.
 
Top