Adds attack bonus to cup of tea

Adds ability to remove-legs on swamp toads
This commit is contained in:
qahowers 2020-03-04 19:58:12 -05:00
parent 9635f05584
commit 050225cc24
4 changed files with 53 additions and 1 deletions

View file

@ -7,7 +7,9 @@
<sourceFolder url="file://$MODULE_DIR$/Management-Server/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/Server/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/Client/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/Client" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/Client" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />

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 for each beer.
*/
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; }
}