- Removed unfinished RPG command
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
package commands.general;
|
||||
|
||||
import core.Command;
|
||||
import core.LocStrings;
|
||||
import core.rpg.RPGFramework;
|
||||
import dataStructures.KittyChannel;
|
||||
import dataStructures.KittyGuild;
|
||||
import dataStructures.KittyRating;
|
||||
import dataStructures.KittyRole;
|
||||
import dataStructures.KittyUser;
|
||||
import dataStructures.Response;
|
||||
import dataStructures.UserInput;
|
||||
|
||||
|
||||
public class CommandRPG extends Command
|
||||
{
|
||||
private RPGFramework framework;
|
||||
|
||||
public CommandRPG(KittyRole role, KittyRating rating)
|
||||
{
|
||||
super(role, rating);
|
||||
framework = new RPGFramework();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText() { return LocStrings.stub("RPGInfo"); };
|
||||
|
||||
|
||||
@Override
|
||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
{
|
||||
if(input.args == null || input.args.length() == 0)
|
||||
{
|
||||
String output = getHelpText();
|
||||
res.send(output);
|
||||
return;
|
||||
}
|
||||
|
||||
String result = null;
|
||||
synchronized(framework)
|
||||
{
|
||||
result = framework.run(user.uniqueID, input.args.trim());
|
||||
}
|
||||
|
||||
if(result == null)
|
||||
{
|
||||
res.send(LocStrings.stub("RPGInvalid"));
|
||||
return;
|
||||
}
|
||||
|
||||
res.send(result);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package commands.rpg;
|
||||
|
||||
import core.rpg.RPGCommand;
|
||||
import core.rpg.RPGInput;
|
||||
import core.rpg.RPGState;
|
||||
|
||||
public class RPGCommandBattleFight extends RPGCommand
|
||||
{
|
||||
@Override
|
||||
public String onRun(RPGState state, RPGInput input)
|
||||
{
|
||||
if(state.battleContext == null)
|
||||
return "```There's nothing to fight!```";
|
||||
|
||||
String out = null;
|
||||
String reward = null;
|
||||
|
||||
out = "No one ever trained you to fight, so you do a silly dance and it weirds your opponent out and they leave. (i need to implement this still)";
|
||||
reward = "+150xp";
|
||||
|
||||
state.battleContext = null;
|
||||
state.player.applyEXP(150);
|
||||
|
||||
if(out != null && reward != null)
|
||||
{
|
||||
out += "\n";
|
||||
out += "\n";
|
||||
out += "[" + reward + "]";
|
||||
}
|
||||
|
||||
if(out != null)
|
||||
out = "```\n" + out + "```";
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package commands.rpg;
|
||||
|
||||
import core.rpg.RPGCommand;
|
||||
import core.rpg.RPGInput;
|
||||
import core.rpg.RPGState;
|
||||
|
||||
public class RPGCommandBattleRun extends RPGCommand
|
||||
{
|
||||
@Override
|
||||
public String onRun(RPGState state, RPGInput input)
|
||||
{
|
||||
if(state.battleContext == null)
|
||||
return "```There's nothing to run from!```";
|
||||
|
||||
long lostGold = (long)(state.player.getGold() * .1);
|
||||
String out = null;
|
||||
|
||||
state.player.spendGold(lostGold);
|
||||
state.battleContext = null;
|
||||
|
||||
out = "You duck behind a tree and manage to escape from encounter just barely!";
|
||||
if(lostGold > 0)
|
||||
{
|
||||
out += " As you make your final move to escape, you accidentally drop some of your gold behind. You don't dare try to go back and pick it up.";
|
||||
out += "\n";
|
||||
out += "\n";
|
||||
out += "[-" + lostGold + "gp]";
|
||||
}
|
||||
|
||||
if(out != null)
|
||||
out = "```\n" + out + "```";
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package commands.rpg;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import core.rpg.RPGBattleContext;
|
||||
import core.rpg.RPGCommand;
|
||||
import core.rpg.RPGInput;
|
||||
import core.rpg.RPGState;
|
||||
|
||||
public class RPGCommandExplore extends RPGCommand
|
||||
{
|
||||
private class Chance
|
||||
{
|
||||
double rand;
|
||||
float lastSection;
|
||||
|
||||
public Chance(float percentChanceTotal)
|
||||
{
|
||||
rand = new Random().nextDouble() * percentChanceTotal;
|
||||
lastSection = 0;
|
||||
}
|
||||
|
||||
public boolean Next(float amount)
|
||||
{
|
||||
lastSection += amount;
|
||||
return rand < lastSection;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onRun(RPGState state, RPGInput input)
|
||||
{
|
||||
Chance chance = new Chance(100);
|
||||
|
||||
String out = null;
|
||||
String reward = null;
|
||||
|
||||
if(state.battleContext != null)
|
||||
return "```You can't explore right now, you're in a fight! Try either 'fight' or 'run'!```";
|
||||
|
||||
if(chance.Next(20))
|
||||
{
|
||||
out = "A creature jumps out of a bush at you!";
|
||||
reward = "Prepare to fight!";
|
||||
state.battleContext = new RPGBattleContext(state);
|
||||
}
|
||||
else if(chance.Next(20))
|
||||
{
|
||||
final int gp = 1;
|
||||
|
||||
out = "As you take a stroll, you spy a small shiny glint from a bush and decide to investigate! Looks like it's your lucky day!";
|
||||
reward = "+" + gp + "gp";
|
||||
state.player.giveGold(gp);
|
||||
}
|
||||
else if(chance.Next(20))
|
||||
{
|
||||
final int healing = 1;
|
||||
final int xp = 25;
|
||||
|
||||
out = "You head out on a lovely stroll down a familiar path - the sun is out and the birds are chirping! Nothing much comes of it, but you feel refreshed.";
|
||||
reward = "+" + xp + "xp, +" + healing + "hp";
|
||||
state.player.applyHealing(healing);
|
||||
state.player.applyEXP(xp);
|
||||
}
|
||||
else if(chance.Next(20))
|
||||
{
|
||||
final int xp = 75;
|
||||
final int damage = 1;
|
||||
|
||||
out = "Today's the day you head out on a new path. You find a lot of little nicknacks and trinkets on the trail, but leave them be. The trail gets really steep, the rocks jagged, but you keep going. Eventually, you make it out to the other side into a small but pleasant town, and collapse on a bench to catch your breath.";
|
||||
reward = "+" + xp + "xp, -" + damage + "hp";
|
||||
state.player.applyEXP(xp);
|
||||
state.player.applyDamage(damage);
|
||||
}
|
||||
else
|
||||
{
|
||||
final int hp = 2;
|
||||
|
||||
out = "You step outside but it starts to rain. You decide not to do much today, and hang about the inn and the tavern.";
|
||||
reward = "+" + hp + "hp";
|
||||
state.player.applyHealing(hp);
|
||||
}
|
||||
|
||||
if(out != null && reward != null)
|
||||
{
|
||||
out += "\n";
|
||||
out += "\n";
|
||||
out += "[" + reward + "]";
|
||||
}
|
||||
|
||||
if(out != null)
|
||||
out = "```\n" + out + "```";
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package commands.rpg;
|
||||
|
||||
import core.rpg.RPGArmor;
|
||||
import core.rpg.RPGCommand;
|
||||
import core.rpg.RPGInput;
|
||||
import core.rpg.RPGState;
|
||||
import core.rpg.RPGWeapon;
|
||||
|
||||
public class RPGCommandInfo extends RPGCommand
|
||||
{
|
||||
@Override
|
||||
public String onRun(RPGState state, RPGInput input)
|
||||
{
|
||||
String out = null;
|
||||
switch(input.value.trim().toLowerCase())
|
||||
{
|
||||
case "weapon":
|
||||
case "weapo":
|
||||
case "weap":
|
||||
case "wea":
|
||||
case "we":
|
||||
case "w":
|
||||
case "wepon":
|
||||
case "wepo":
|
||||
case "wep":
|
||||
case "hand":
|
||||
case "att":
|
||||
case "attack":
|
||||
out = weaponStats(state.player.getWeapon());
|
||||
break;
|
||||
|
||||
case "armour":
|
||||
case "armou":
|
||||
case "armor":
|
||||
case "armr":
|
||||
case "armo":
|
||||
case "arm":
|
||||
case "ar":
|
||||
case "a":
|
||||
case "def":
|
||||
case "defense":
|
||||
case "body":
|
||||
case "dress":
|
||||
case "wear":
|
||||
case "outfit":
|
||||
out = armorStats(state.player.getArmor());
|
||||
break;
|
||||
}
|
||||
|
||||
if(out != null)
|
||||
out = "```\n" + out + "```";
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
private String weaponStats(RPGWeapon weapon)
|
||||
{
|
||||
if(weapon == null)
|
||||
return null;
|
||||
|
||||
String out = "";
|
||||
out += "[" + weapon.getName() + "]";
|
||||
out += "\n";
|
||||
out += " att: " + weapon.getAttack();
|
||||
out += "\n";
|
||||
out += "value: " + weapon.getValue() + "gp";
|
||||
out += "\n";
|
||||
out += "\n";
|
||||
out += weapon.getDescription();
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
private String armorStats(RPGArmor armor)
|
||||
{
|
||||
if(armor == null)
|
||||
return null;
|
||||
|
||||
String out = "";
|
||||
out += "[" + armor.getName() + "]";
|
||||
out += "\n";
|
||||
out += " def: " + armor.getDefense();
|
||||
out += "\n";
|
||||
out += "value: " + armor.getValue() + "gp";
|
||||
out += "\n";
|
||||
out += "\n";
|
||||
out += armor.getDescription();
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package commands.rpg;
|
||||
|
||||
import core.rpg.RPGArmor;
|
||||
import core.rpg.RPGCommand;
|
||||
import core.rpg.RPGExpTable;
|
||||
import core.rpg.RPGInput;
|
||||
import core.rpg.RPGPlayer;
|
||||
import core.rpg.RPGState;
|
||||
import core.rpg.RPGWeapon;
|
||||
|
||||
public class RPGCommandStats extends RPGCommand
|
||||
{
|
||||
@Override
|
||||
public String onRun(RPGState state, RPGInput input)
|
||||
{
|
||||
RPGPlayer player = state.player;
|
||||
long exp = player.getEXP();
|
||||
long level = RPGExpTable.levelFromEXP(player.getEXP());
|
||||
long ceil = RPGExpTable.expCeil(level);
|
||||
|
||||
String indent = "";
|
||||
String linebreak = "\n";
|
||||
|
||||
String out = "";
|
||||
out += indent + "[" + player.getName() + ", lv. " + level + "]";
|
||||
out += indent + linebreak;
|
||||
out += indent + "_______________";
|
||||
out += indent + linebreak;
|
||||
|
||||
out += indent + " EXP: " + exp;
|
||||
out += indent + " (until next: " + (ceil - exp) + ")";
|
||||
out += indent + linebreak;
|
||||
|
||||
out += indent + " Gold: " + player.getGold();
|
||||
out += indent + linebreak;
|
||||
|
||||
out += indent + "Health: " + player.getHealthCurrent() + "/" + player.getHealthMax();
|
||||
out += indent + linebreak;
|
||||
|
||||
RPGWeapon weapon = player.getWeapon();
|
||||
out += indent + "_____";
|
||||
out += indent + linebreak;
|
||||
out += indent + "Weapon: " + weapon.getName();
|
||||
out += indent + linebreak;
|
||||
out += indent + " att: " + weapon.getAttack();
|
||||
out += indent + linebreak;
|
||||
|
||||
RPGArmor armor = player.getArmor();
|
||||
out += indent + "_____";
|
||||
out += indent + linebreak;
|
||||
out += indent + "Armor: " + armor.getName();
|
||||
out += indent + linebreak;
|
||||
out += indent + " def: " + armor.getDefense() ;
|
||||
out += indent + linebreak;
|
||||
|
||||
out += indent + linebreak;
|
||||
out += "Use 'info armor' / 'info weapon' for details!";
|
||||
|
||||
return "```\n" + out + "```";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user