Package ruscz.game.gameOfProd.Scripts
Class TextParser
- java.lang.Object
-
- ruscz.game.gameOfProd.Scripts.TextParser
-
public class TextParser extends java.lang.ObjectThis class parses text form player into a set of commands This class is currently not being used in our game, though it will be implemented at a later date
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringactionprivate Battlebattleprivate Itemitemprivate BattlePersonpersonprivate BattlePersontargetprivate java.lang.StringtextToParse
-
Constructor Summary
Constructors Constructor Description TextParser()
-
Method Summary
Modifier and Type Method Description private voidparseBattleAction(java.lang.String action)Calls corresponding action to user inputprivate voidparseBattlePerson(java.lang.String personText)Finds battle person based on text input and sets it as actor of actionprivate voidparseBattleTarget(java.lang.String targetText)Finds battle person based on text input and sets it as target of actionvoidparseBattleText(java.lang.String text)Separates incoming text into parts and passes them on to be parsed further
-
-
-
Field Detail
-
textToParse
private java.lang.String textToParse
-
battle
private Battle battle
-
person
private BattlePerson person
-
target
private BattlePerson target
-
item
private Item item
-
action
private java.lang.String action
-
-
Method Detail
-
parseBattleText
public void parseBattleText(java.lang.String text)
Separates incoming text into parts and passes them on to be parsed further- Parameters:
text- is input from player
-
parseBattlePerson
private void parseBattlePerson(java.lang.String personText)
Finds battle person based on text input and sets it as actor of action- Parameters:
personText- is name of battle person
-
parseBattleAction
private void parseBattleAction(java.lang.String action)
Calls corresponding action to user input- Parameters:
action- is name of action
-
parseBattleTarget
private void parseBattleTarget(java.lang.String targetText)
Finds battle person based on text input and sets it as target of action- Parameters:
targetText- name of battle person
-
-