@@ -14,12 +14,34 @@ import { EmojiExecution } from "../EmojiExecution";
1414import { PseudoRandom } from "../../PseudoRandom" ;
1515import { flattenedEmojiTable } from "../../Util" ;
1616
17+ const emojiId = ( e : string ) => flattenedEmojiTable . indexOf ( e ) ;
18+ const EMOJI_ASSIST_ACCEPT = [
19+ "👍" ,
20+ "⛵" ,
21+ "🤝" ,
22+ "🎯" ,
23+ ] . map ( emojiId ) ;
24+ const EMOJI_RELATION_TOO_LOW = [
25+ "🥱" ,
26+ "🤦" ,
27+ ] . map ( emojiId ) ;
28+ const EMOJI_TARGET_ME = [
29+ "🥺" ,
30+ "💀" ,
31+ ] . map ( emojiId ) ;
32+ const EMOJI_TARGET_ALLY = [
33+ "🕊️" ,
34+ "👎" ,
35+ ] . map ( emojiId ) ;
36+ export const EMOJI_HECKLE = [
37+ "🤡" ,
38+ "😡" ,
39+ ] . map ( emojiId ) ;
40+
1741export class BotBehavior {
1842 private enemy : Player | null = null ;
1943 private enemyUpdated : Tick | undefined ;
2044
21- private readonly assistAcceptEmoji = flattenedEmojiTable . indexOf ( "👍" ) ;
22-
2345 constructor (
2446 private readonly random : PseudoRandom ,
2547 private readonly game : Game ,
@@ -155,26 +177,29 @@ export class BotBehavior {
155177 }
156178
157179 assistAllies ( ) {
158- outer: for ( const ally of this . player . allies ( ) ) {
180+ for ( const ally of this . player . allies ( ) ) {
159181 if ( ally . targets ( ) . length === 0 ) continue ;
160182 if ( this . player . relation ( ally ) < Relation . Friendly ) {
161- // this.emoji(ally, "🤦");
183+ const emoji = this . random . randElement ( EMOJI_RELATION_TOO_LOW ) ;
184+ this . emoji ( ally , emoji ) ;
162185 continue ;
163186 }
164187 for ( const target of ally . targets ( ) ) {
165188 if ( target === this . player ) {
166- // this.emoji(ally, "💀");
189+ const emoji = this . random . randElement ( EMOJI_TARGET_ME ) ;
190+ this . emoji ( ally , emoji ) ;
167191 continue ;
168192 }
169193 if ( this . player . isAlliedWith ( target ) ) {
170- // this.emoji(ally, "👎");
194+ const emoji = this . random . randElement ( EMOJI_TARGET_ALLY ) ;
195+ this . emoji ( ally , emoji ) ;
171196 continue ;
172197 }
173198 // All checks passed, assist them
174199 this . player . updateRelation ( ally , - 20 ) ;
175200 this . setNewEnemy ( target ) ;
176- this . emoji ( ally , this . assistAcceptEmoji ) ;
177- break outer ;
201+ this . emoji ( ally , EMOJI_ASSIST_ACCEPT ) ;
202+ return ;
178203 }
179204 }
180205 }
0 commit comments