-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStoryCharacter.java
More file actions
97 lines (84 loc) · 3.02 KB
/
Copy pathStoryCharacter.java
File metadata and controls
97 lines (84 loc) · 3.02 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
package storyelements;
/**
*
* @author etienne
*/
public class StoryCharacter extends StoryElement {
private String aOccupation;
private String aRelation;
private boolean isFemale = true;
public StoryCharacter(String pOcc, String pRel) {
aOccupation = pOcc;
aRelation = pRel;
setGender();
}
public StoryCharacter(String pOcc) {
aOccupation = pOcc;
aRelation = "";
setGender();
}
private void setGender() {
if (!aRelation.equals("")) {
if (aRelation.contains("Daughter") || aRelation.contains("Mother")
|| aRelation.contains("Girlfriend") || aRelation.contains("Sister")
|| aRelation.contains("Grandmother") || aRelation.contains("Wife")) {
isFemale = true;
} else if (aRelation.contains("Son") || aRelation.contains("Father")
|| aRelation.contains("Boyfriend") || aRelation.contains("Brother")
|| aRelation.contains("Grandfather") || aRelation.contains("Husband")) {
isFemale = false;
} else {
isFemale = Math.random() < 0.5;
}
}
else {
if (aOccupation.contains("Princess") || aOccupation.contains("Queen")
|| aOccupation.contains("Dame") || aOccupation.contains("Lady")
|| aOccupation.contains("Sorceress") || aOccupation.contains("Witch")
|| aOccupation.contains("Widow") || aOccupation.contains("Amazon")
|| aOccupation.contains("Priestess") || aOccupation.contains("Empress")
|| aOccupation.contains("Nun")) {
isFemale = true;
} else if (aOccupation.contains("Prince") || aOccupation.contains("King")
|| aOccupation.contains("Lord") || aOccupation.contains("Sorcerer")
|| aOccupation.contains("Wizard") || aOccupation.contains("Priest")
|| aOccupation.contains("Emperor") || aOccupation.contains("Fisherman")
|| aOccupation.contains("Monk")) {
isFemale = false;
} else {
isFemale = Math.random() < 0.5;
}
}
}
@Override
public String toString() {
if (aRelation.equals("")) {
return aOccupation;
}
else {
return aRelation + " of the " + aOccupation;
}
}
public String getSubjectPronoun() {
if (isFemale) return "she";
else return "he";
}
public String getObjectPronoun() {
if (isFemale) return "her";
else return "him";
}
public String getPossessivePronoun() {
if (isFemale) return "her";
else return "his";
}
public String getOccupation() {
return aOccupation;
}
public String getRelation() {
return aRelation;
}
public String getGender() {
if (isFemale) return "F";
else return "M";
}
}