Parcourir la source

Multiple shortcuts for Say

Reddo il y a 5 ans
Parent
commit
d043c87c15

+ 50 - 0
app/Elements/Classes/Say.ts

@@ -37,6 +37,14 @@ class Say {
 
     private centered : boolean = false;
 
+    public static Action (a : any) {
+        return new SayAction(a);
+    }
+
+    public static Bold (a : any) {
+        return new SayBold(a);
+    }
+
     public static Mention (target : Thing, uppercase = true) : Array<any> {
         if (target == WorldState.player) {
             return [new SayYou(uppercase)];
@@ -57,6 +65,48 @@ class Say {
         }
     }
 
+    public Article (target : Thing, uppercase = true) {
+        let arr = [];
+        if (target.isUnique()) {
+            arr.push(new SayThe(uppercase));
+        } else {
+            arr.push(new SayAn(uppercase));
+        }
+        arr.push(target);
+        return arr;
+    }
+
+    /**
+     * He, She, It
+     * @param target
+     * @param uppercase
+     * @constructor
+     */
+    public Subject (target : Thing, uppercase = true) {
+        return new SayHeSheIt(target, uppercase);
+    }
+
+    /**
+     * Him, Her, It
+     * @param target
+     * @param uppercase
+     * @constructor
+     */
+    public Object (target : Thing, uppercase = true) {
+        return new SayHimHerIt(target, uppercase);
+    }
+
+    /**
+     * His, Hers, Its
+     * @param target
+     * @param uppercase
+     * @constructor
+     */
+    public Possessive (target : Thing, uppercase = true) {
+        return new SayHisHersIts(target, uppercase);
+    }
+
+
     public static Speak (speaker : Thing | string, ...message : Array<any>) {
         if (typeof speaker == "string") {
             return [new SayBold(speaker, ": "), ...message];

+ 3 - 1
app/Elements/Classes/Say/SayHeSheIt.ts

@@ -18,7 +18,9 @@ class SayHeSheIt extends Say {
         } else {
             if (next instanceof Humanoid) {
                 let gender = next.getGenderValue();
-                if (gender.genderValueCorrected > 65) {
+                if (WorldState.isPlayer(next)) {
+                    this.node.nodeValue = "I";
+                } else if (gender.genderValueCorrected > 65) {
                     this.node.nodeValue = "she ";
                 } else if (gender.genderValueCorrected < 35) {
                     this.node.nodeValue = "he ";

+ 3 - 1
app/Elements/Classes/Say/SayHimHerIt.ts

@@ -18,7 +18,9 @@ class SayHimHerIt extends Say {
         } else {
             if (next instanceof Humanoid) {
                 let gender = next.getGenderValue();
-                if (gender.genderValueCorrected > 65) {
+                if (WorldState.isPlayer(next)) {
+                    this.node.nodeValue = "me";
+                } else if (gender.genderValueCorrected > 65) {
                     this.node.nodeValue = "her ";
                 } else if (gender.genderValueCorrected < 35) {
                     this.node.nodeValue = "him ";

+ 3 - 1
app/Elements/Classes/Say/SayHisHersIts.ts

@@ -18,7 +18,9 @@ class SayHisHersIts extends Say {
         } else {
             if (next instanceof Humanoid) {
                 let gender = next.getGenderValue();
-                if (gender.genderValueCorrected > 65) {
+                if (WorldState.isPlayer(next)) {
+                    this.node.nodeValue = "my";
+                } else if (gender.genderValueCorrected > 65) {
                     this.node.nodeValue = "hers ";
                 } else if (gender.genderValueCorrected < 35) {
                     this.node.nodeValue = "his ";