itemstats: Add variable healing food
This commit is contained in:
@@ -79,4 +79,9 @@ public class Builders
|
||||
{
|
||||
return new DeltaPercentage(perc, delta);
|
||||
}
|
||||
|
||||
public static RangeStatBoost range(StatBoost a, StatBoost b)
|
||||
{
|
||||
return new RangeStatBoost(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,6 @@ public class ItemStatChanges
|
||||
add(new Anglerfish(), ANGLERFISH);
|
||||
add(food(maxHP -> (int) Math.ceil(maxHP * .06)), STRAWBERRY);
|
||||
add(food(maxHP -> (int) Math.ceil(maxHP * .05)), WATERMELON_SLICE);
|
||||
add(food(perc(.1, 0)), COOKED_SLIMY_EEL);
|
||||
add(food(perc(.1, 1)), COOKED_SWEETCORN, SWEETCORN_7088 /* Bowl of cooked sweetcorn */);
|
||||
add(combo(food(1), boost(DEFENCE, perc(.02, 1))), CABBAGE_1967 /* Draynor Manor */);
|
||||
add(combo(2, food(4), heal(RUN_ENERGY, 5)), PAPAYA_FRUIT);
|
||||
@@ -95,9 +94,9 @@ public class ItemStatChanges
|
||||
add(food(2), BAT_SHISH, COATED_FROGS_LEGS, FILLETS, FINGERS, FROGBURGER, FROGSPAWN_GUMBO, GREEN_GLOOP_SOUP,
|
||||
GRUBS__LA_MODE, MUSHROOMS, ROAST_FROG);
|
||||
add(food(3), LOACH);
|
||||
// FROG_SPAWN (3~6?)
|
||||
// COOKED_SLIMY_EEL (6~10?)
|
||||
// CAVE_EEL (7~11?)
|
||||
add(range(food(3), food(6)), FROG_SPAWN);
|
||||
add(range(food(6), food(10)), COOKED_SLIMY_EEL);
|
||||
add(range(food(8), food(12)), CAVE_EEL);
|
||||
add(food(10), EEL_SUSHI);
|
||||
|
||||
// Alcoholic Gnome Cocktails
|
||||
@@ -180,6 +179,7 @@ public class ItemStatChanges
|
||||
add(combo(2, heal(HITPOINTS, 11), boost(AGILITY, 5), heal(RUN_ENERGY, 10)), SUMMER_PIE, HALF_A_SUMMER_PIE);
|
||||
|
||||
// Other
|
||||
add(combo(range(food(1), food(3)), heal(RUN_ENERGY, 10)), PURPLE_SWEETS_10476);
|
||||
add(new SpicyStew(), SPICY_STEW);
|
||||
add(boost(MAGIC, perc(.10, 1)), IMBUED_HEART);
|
||||
add(combo(boost(ATTACK, 2), boost(STRENGTH, 1), heal(DEFENCE, -1)), JANGERBERRIES);
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Abex
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client.plugins.itemstats;
|
||||
|
||||
import net.runelite.api.Client;
|
||||
|
||||
public class RangeStatBoost extends SingleEffect
|
||||
{
|
||||
private final StatBoost a;
|
||||
private final StatBoost b;
|
||||
|
||||
RangeStatBoost(StatBoost a, StatBoost b)
|
||||
{
|
||||
assert a.getStat() == b.getStat();
|
||||
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatChange effect(Client client)
|
||||
{
|
||||
final StatChange a = this.a.effect(client);
|
||||
final StatChange b = this.b.effect(client);
|
||||
|
||||
final StatChange r = new StatChange();
|
||||
r.setAbsolute(concat(a.getAbsolute(), b.getAbsolute()));
|
||||
r.setRelative(concat(a.getRelative(), b.getRelative()));
|
||||
r.setTheoretical(concat(a.getTheoretical(), b.getTheoretical()));
|
||||
r.setStat(a.getStat());
|
||||
|
||||
final int avg = (a.getPositivity().ordinal() + b.getPositivity().ordinal()) / 2;
|
||||
r.setPositivity(Positivity.values()[avg]);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
private String concat(String a, String b)
|
||||
{
|
||||
// If they share a operator, strip b's duplicate
|
||||
if (a.length() > 1 && b.length() > 1)
|
||||
{
|
||||
final char a0 = a.charAt(0);
|
||||
if ((a0 == '+' || a0 == '-' || a0 == '±') && b.charAt(0) == a0)
|
||||
{
|
||||
b = b.substring(1);
|
||||
}
|
||||
}
|
||||
|
||||
return a + "~" + b;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user