-
Notifications
You must be signed in to change notification settings - Fork 0
/
MotionDataSample.java
84 lines (67 loc) · 2.21 KB
/
MotionDataSample.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import commandcenter.CommandCenter;
import enumerate.Action;
import structs.FrameData;
import structs.GameData;
import structs.Key;
import structs.MotionData;
import gameInterface.AIInterface;
/**
* This class is a sample AI for Fighting ICE.
* It gives a very simple sample on how to use the method CancelAbleFrame in the class MotionData.
* The AI does nothing but displays its opponent@character's return value of CancelAbleFrame.
* @author Yamamoto, Team Fighting ICE.
*
*/
public class MotionDataSample implements AIInterface {
boolean p;
GameData gd;
Key inputKey;
FrameData fd;
CommandCenter cc;
@Override
public int initialize(GameData gameData, boolean playerNumber) {
// TODO Auto-generated method stub
gd = gameData;
p = playerNumber;
inputKey = new Key();
fd = new FrameData();
cc = new CommandCenter();
return 0;
}
@Override
public void getInformation(FrameData frameData) {
// TODO Auto-generated method stub
fd = frameData;
cc.setFrameData(fd, p);
}
@Override
public void processing() {
if(!fd.getEmptyFlag()){
if(fd.getRemainingTime() > 0){
// In order to get CancelAbleFrame's information on the current action of the opponent character, first you write as follows:
Action oppAct = cc.getEnemyCharacter().getAction();
// If you want the same information on a specific action, say "STAND_A", you can simply write:
// Action action = Action.STAND_A;
// Next, get the MotionData information on the opponent character's action of interest from GameData.
// You can access the MotionData information with
// gd.getPlayer???Motion.elementAt("an instance of action (e.g., oppAct or action)".ordinal())
MotionData oppMotion = new MotionData();
if(p)oppMotion = gd.getPlayerTwoMotion().elementAt(oppAct.ordinal());
else oppMotion = gd.getPlayerOneMotion().elementAt(oppAct.ordinal());
System.out.println(oppMotion.getMotionName()+":cancelable " + oppMotion.getCancelAbleFrame() + " frame.");
}
}
}
@Override
public Key input() {
// TODO Auto-generated method stub
return inputKey;
}
@Override
public void close() {
// TODO Auto-generated method stub
}
public String getCharacter(){
return CHARACTER_ZEN;
}
}