Feature - Rejected Maximizing Outfit Letters for PvP

syrinxlui

Member
Could we get a new option in the modifier maximizer that maximizes that day's letters for PvP? Today the contest is to see who can wear gear with the most letter Ks in it. It would be nice to have a one-click option for that. Danke.

Edit: That may not have been clear. I was hoping mafia could check which letter is currently active, that way only one new option needs to appear in the modifier maximizer, rather than 26 new options.
 
Last edited:

lostcalpolydude

Developer
Staff member
The reason that there is no longer a GUI for pvp in mafia is that I don't want to add code to support the minis every time a new one comes out, so no.
 
Well, you're usually wanting to strike an arbitrary balance between a bunch of different modifiers. That's a pretty complex problem which the maximiser is already really good at.

I totally understand not wanting to add mafia features for every wierd pvp mini that comes along though.

I've not looked at the maximiser code so no idea how feasible it is, but it'd be really cool if you could define arbitrary modifiers.
So give the maximiser an input like:
1 item, 0.5 meat, {ash value.name_length;} , {ash import somescript.ash; somefunction(value);}
 
Last edited:

Crowther

Active member
I've not looked at the maximiser code so no idea how feasible it is, but it'd be really cool if you could define arbitrary modifiers.
I too wanted to be able to balance multiple things at once. The Verbosity Demonstration mini has come up three times in six season. I'd love to do "maximize 100 adv, -1 verbosity" for example. I tried to add it myself, but that code is very complex and I was stumped.
 
Well that sort of thing isn't SO bad if you're ok with considering items individually, ignoring outfits and other synergistic effects.

At the risk of losing my competitive edge (lol) this is what I'm running for fites at the moment. It's a heavily modified version of a verbosity script Bale wrote. It's pretty easy to add whatever you like to the valuation function.

Code:
float verbweight = 0.2;
float letterweight = 10;
float elemresistweight = 10;
float famweightweight = 5;
float powerweight = -100;
float diveweight = 1.5;

string checkletter;

int lettersinname(item g, string l)
{
  int lettercount=0;
  for pos from 0 to length(g)-1
  {
    if (char_at(g,pos)==l) lettercount+=1;  
  }
  return lettercount;
}

int checkdive(item g) // needs improving - may return stuff that just boosts a single modifier rather than reducing dive penalty
{
  string modstring = string_modifier(g,"Modifiers");
  matcher divematcher = create_matcher("(\\d+)\\*zone\\(The Sea\\)",modstring);
  if (divematcher.find()) return to_int(divematcher.group(1)); else return 0;
}

int valuation(item g)
{
  int thisvalue;
  thisvalue += g.name_length*verbweight;
  thisvalue += lettersinname(g,checkletter)*letterweight;

  thisvalue += min(numeric_modifier(g,"Cold Resistance"),min(numeric_modifier(g,"Hot Resistance"),min(numeric_modifier(g,"Spooky Resistance"),min(numeric_modifier(g,"Sleaze Resistance"),numeric_modifier(g,"Stench Resistance")))))*elemresistweight;

  thisvalue += numeric_modifier(g,"Familiar Weight")*famweightweight;
  
  if (to_slot(g)==to_slot("hat") || to_slot(g)==to_slot("pants") || to_slot(g)==to_slot("shirt")) thisvalue += get_power(g)*powerweight;

  thisvalue += checkdive(g)*diveweight;

  return 0-thisvalue;
}

void main(string letter)
{
  checkletter=letter;
  item [slot] [int] gear;
  slot sl;

  foreach i in $items[]
    if(available_amount(i) > 0 && to_slot(i) != $slot[none]) {
      sl = to_slot(i);
      if((can_equip(i) || sl == $slot[familiar]) && !(sl == $slot[weapon] && weapon_hands(i) > 1))
        gear [sl] [count(gear[sl])] = i;
    }

  foreach s in gear
  {
    sort gear[s] by valuation(value);
  }

  boolean gearup(slot s, item it) {
    if(it == $item[none]) return false;
    if(equipped_amount(it) < 1 && item_amount(it) < 1)
      retrieve_item(1, it);
    return equip(s, it);
  }

  foreach s in $slots[hat, back, weapon, off-hand, shirt, pants]
    gearup(s, gear[s][0]);

  gearup($slot[acc1], gear[$slot[acc1]][0]);
  int acctry=0;
  int accslot=1;

  foreach s in $slots[acc2,acc3]
  {
    if(available_amount(gear[$slot[acc1]][acctry]) < 1+accslot
          || boolean_modifier(gear[$slot[acc1]][acctry],"Single Equip")==true)
      {
        acctry+=1;
      }
    else {accslot+=1;}
    
    gearup(s, gear[$slot[acc1]][acctry]);
  }

  item fam = gear[$slot[familiar]][0];
  if(can_equip(fam))
    gearup($slot[familiar], fam);
  else print_html("<b>"+fam+"</b> is recommended, but it cannot be equipped on your current familiar");
}

You'll might well want to mess with weights cos i just set them to semi random numbers that looked vaguely appropriate.
 
This is a very handy little script, but it did something weird for the familiar gear. It recommended a cracker for the 'N' challenge. Any thoughts?
 
Top