Merge pull request #139 from qahowers/master

Add swamp-toad leg removal, tea attack bonus
This commit is contained in:
Daniel Ginovker 2020-03-06 18:59:46 -05:00 committed by GitHub
commit 0fc1ddfe9a
3 changed files with 51 additions and 1 deletions

View file

@ -3,6 +3,8 @@ package plugin.consumable;
import org.crandor.game.content.global.consumable.ConsumableProperties;
import org.crandor.game.content.global.consumable.Consumables;
import org.crandor.game.content.global.consumable.Drink;
import org.crandor.game.content.skill.SkillBonus;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.entity.player.Player;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.game.node.item.Item;
@ -15,6 +17,11 @@ import org.crandor.game.node.item.Item;
@InitializablePlugin
public final class CupofTeaPlugin extends Drink {
/**
* Represents the skill bonuses.
*/
private SkillBonus[] bonuses;
/**
* Represents the force chat to use.
*/
@ -30,12 +37,19 @@ public final class CupofTeaPlugin extends Drink {
* Constructs a new {@code CupofTeaPlugin} {@code Object}.
*/
public CupofTeaPlugin() {
super(712, new ConsumableProperties(2, 1980));
super(712, new ConsumableProperties(3, 1980));
this.bonuses = new SkillBonus[1];
this.bonuses[0] = new SkillBonus(Skills.ATTACK, 0, 3);
}
@Override
public void consume(final Item item, final Player player) {
player.sendChat(CHAT);
if (this.bonuses != null) {
for (SkillBonus b : bonuses) {
addBonus(player, b);
}
}
super.remove(player, item);
}

View file

@ -0,0 +1,36 @@
package plugin.skill.herblore;
import org.crandor.cache.def.impl.ItemDefinition;
import org.crandor.game.interaction.OptionHandler;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.item.Item;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Represents the swamp toad plugin.
* @author Zombiemode
* @version 1.0
*/
@InitializablePlugin
public final class SwampToadPlugin extends OptionHandler {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
ItemDefinition.setOptionHandler("remove-legs", this);
return this;
}
@Override
public boolean handle(Player player, Node node, String option) {
if (player.getInventory().replace(new Item(2152), ((Item) node).getSlot()) != null) {
player.getPacketDispatch().sendMessage("You pull the legs off the toad. Poor toad. At least they'll grow back.");
}
return true;
}
@Override
public boolean isWalk() { return false; }
}