1/***************************** 2 3ACT II: THE ESCALATION 41. Weird square screams at others 52. Circle becomes fearful 63. Square becomes snobby 74. Circle becomes angry... 85. Angry escalates... until... 9 10******************************/ 11 12function Stage_Screamer(self){ 13 14 // The crazy one 15 var crazy = new CrazyPeep(self); 16 self.world.addPeep(crazy); 17 18 // Director 19 self.director.callbacks = { 20 takePhoto: function(d){ 21 22 // IMPORTANCE: 23 // 1. Screamer Dude 24 // 2. Lovers 25 // 3. Hats 26 // 4. Shocked Peeps 27 // 5. Everything else. 28 d.tryChyron(function(d){ 29 var p = d.photoData; 30 var caught = d.caught({ 31 shocked: {_CLASS_:"NormalPeep", shocked:true}, 32 crazy: {_CLASS_:"CrazyPeep"} 33 }); 34 if(caught.crazy){ 35 if(crazy.isScreaming()){ 36 p.HIJACK = true; 37 p.audienceCircles = 1; 38 p.audienceSquares = 0; 39 p.caughtCrazy = caught.crazy; 40 d.chyron = textStrings["crazySquareAttacks"]; 41 }else{ 42 if(caught.shocked) d.chyron = textStrings["justMissed"]; 43 else d.chyron = textStrings["somethingInteresting"]; 44 } 45 return true; 46 } 47 return false; 48 }) 49 .otherwise(_chyLovers) 50 .otherwise(_chyHats) 51 .otherwise(function(d){ 52 var p = d.photoData; 53 var caught = d.caught({ 54 shocked: {_CLASS_:"NormalPeep", shocked:true} 55 }); 56 if(caught.shocked) d.chyron = textStrings["whoIsScreaming"]; 57 return caught.shocked; 58 }) 59 .otherwise(_chyPeeps); 60 61 }, 62 movePhoto: function(d){ 63 d.audience_movePhoto(); 64 }, 65 cutToTV: function(d){ 66 67 // Importance: 68 // 1. Crazy 69 // 2. Lovers 70 // 3. Hats 71 // 4. Everything Else 72 d.tryCut2TV(function(d){ 73 var p = d.photoData; 74 if(p.caughtCrazy){ 75 self.world.addBalancedPeeps(1); // Add with moar! 76 d.audience_cutToTV(); // Show audience watching! 77 p.caughtCrazy.kill(); // Get rid of crazy 78 self.world.replaceWatcher("circle", new NervousPeep(self)); // Replace with nervous 79 Stage_Nervous(self); // Next stage 80 return true; 81 } 82 return false; 83 }) 84 .otherwise(_cutLovers) 85 .otherwise(_cutHats) 86 .otherwise(_cutPeeps); 87 88 } 89 }; 90 91} 92 93function Stage_Nervous(self, HACK){ 94 95 // Also, get rid of the lovers if they're still here. 96 self.world.peeps.filter(function(peep){ 97 return peep._CLASS_=="LoverPeep"; 98 }
98).forEach(function(lover){ 99 lover.kill(); 100 }); 101 102 // HACK - The nervous one 103 if(HACK){ 104 var nervous = new NervousPeep(self); 105 self.world.addPeep(nervous); 106 nervous.HACK_JUMPSTART(); 107 } 108 109 // Director 110 self.director.callbacks = { 111 takePhoto: function(d){ 112 113 // IMPORTANCE: 114 // 1. Nervous 115 // 2. Hats 116 // 3. Everything else. 117 d.tryChyron(function(d){ 118 var p = d.photoData; 119 var caught = d.caught({ 120 confused: {_CLASS_:"NormalPeep", confused:true}, 121 nervous: {_CLASS_:"NervousPeep"} 122 }); 123 if(caught.nervous){ 124 if(caught.nervous.isScared()){ 125 if(caught.confused){ 126 p.HIJACK = true; 127 p.audienceCircles = 0; 128 p.audienceSquares = 1; 129 p.caughtNervous = caught.nervous; 130 d.chyron = textStrings["circleFearsSquares"]; 131 }else{ 132 d.chyron = textStrings["whoScaresThem"]; 133 } 134 }else{ 135 d.chyron = textStrings["somethingInteresting"]; 136 // d.chyron = textStrings["areTheyScared"]; 137 } 138 return true; 139 } 140 return false; 141 }) 142 .otherwise(_chyHats) 143 .otherwise(_chyPeeps); 144 145 }, 146 movePhoto: function(d){ 147 d.audience_movePhoto(); 148 }, 149 cutToTV: function(d){ 150 151 // IMPORTANCE: 152 // 1. Nervous 153 // 2. Hats 154 // 3. Everything else. 155 156 d.tryCut2TV(function(d){ 157 var p = d.photoData; 158 if(p.caughtNervous){ 159 self.world.addBalancedPeeps(1); // Add with moar! 160 d.audience_cutToTV(); // Show audience watching! 161 p.caughtNervous.kill(); // Get rid of nervous 162 self.world.replaceWatcher("square", new SnobbyPeep(self)); // Replace with snpb 163 Stage_Snobby(self); // Next stage 164 return true; 165 } 166 return false; 167 }) 168 .otherwise(_cutHats) 169 .otherwise(_cutPeeps); 170 171 } 172 }; 173 174} 175 176function Stage_Snobby(self, HACK){ 177 178 // HACK - The snobby one 179 if(HACK){ 180 var snobby = new SnobbyPeep(self); 181 self.world.addPeep(snobby); 182 snobby.HACK_JUMPSTART(); 183 } 184 185 // Director 186 self.director.callbacks = { 187 takePhoto: function(d){ 188 189 // Importance: 190 // 1. Snobby 191 // 2. Hats 192 // 3. Everything else 193 194 d.tryChyron(function(d){ 195 var p = d.photoData; 196 var caught = d.caught({ 197 offended: {_CLASS_:"NormalPeep", offended:true}, 198 snobby: {_CLASS_:"SnobbyPeep"} 199 }); 200 if(caught.snobby){ 201 if(caught.snobby.isSmug){ 202 p.HIJACK = true; 203 p.audienceCircles = 1; 204 p.audienceSquares = 0; 205 p.caughtSnobby = caught.snobby; 206 d.chyron = textStrings["squaresSnubCircles"]; 207 }else{ 208 //d.chyron = textStrings["areTheySnubbed"]; 209 d.chyron = textStrings["somethingInteresting"]; 210 } 211 return true; 212 } 213 return false; 214 }) 215 .otherwise(_chyHats) 216 .otherwise(_chyPeeps); 217 218 }, 219 movePhoto: function(d){ 220 d.audience_movePhoto(); 221 }, 222 cutToTV: function(d){ 223 224 // Importance: 225 // 1. Snobby 226 // 2. Hats 227 // 3. Everything else 228 229 d.tryCut2TV(function(d){ 230 var p = d.photoData; 231 if(p.caughtSnobby){ 232 233 // self.world.addBalancedPeeps(1); // Add with moar! 234 235 // Get rid of all hats 236 self.world.peeps.slice(0).filter(function(peep){ 237 return peep.wearingHat; 238 }
238).forEach(function(hatPeep){ 239 hatPeep.takeOffHat(true); 240 }); 241 242 d.audience_cutToTV(); // Show audience watching! 243 p.caughtSnobby.kill(); // Get rid of snob 244 245 // Replace with angry 246 var angry = new AngryPeep(self, "circle"); 247 self.world.replaceWatcher("circle",angry); 248 249 Stage_Angry_Escalation(self); // Next stage 250 251 return true; 252 253 } 254 return false; 255 }) 256 .otherwise(_cutHats) 257 .otherwise(_cutPeeps); 258 259 } 260 }; 261 262} 263 264function Stage_Angry_Escalation(self, HACK){ 265 266 // HACK - ONE angry one 267 if(HACK){ 268 var angry = new AngryPeep(self, "circle"); 269 self.world.addPeep(angry); 270 angry.HACK_JUMPSTART(); 271 } 272 273 // HELPING. 274 var helping = new HelpingAnim(self); 275 self.world.addProp(helping); 276 277 // PROTESTERS! 278 var protest = null; 279 var _addProtesters = function(){ 280 281 // ONCE 282 if(protest) return; 283 protest = new ProtestAnim(self); 284 285 self.world.addProp(protest); 286 287 } 288 289 // Director 290 self.director.callbacks = { 291 takePhoto: function(d){ 292 293 // IMPORTANCE: 294 // 1. Helping 295 // 2. Protest 296 // 3. Angry 297 // 4. Weirdo 298 // 5. Shocked 299 // 6. Everything Else 300 301 d.tryChyron(_chyHelping) 302 .otherwise(_chyProtest) 303 .otherwise(_chyAngry) 304 .otherwise(_chyWeirdo) 305 .otherwise(_chyShocked) 306 .otherwise(_chyPeeps) 307 308 }, 309 movePhoto: function(d){ 310 d.audience_movePhoto(); 311 }, 312 cutToTV: function(d){ 313 314 // IMPORTANCE: 315 // 1. Helping 316 // 2. Protest 317 // 3. Angry 318 // 4. Weirdo 319 // 5. Shocked 320 // 6. Everything Else 321 322 d.tryChyron(_cutHelping) 323 .otherwise(_cutProtest) 324 .otherwise(_cutAngry) 325 .otherwise(_cutWeirdo) 326 .otherwise(_cutShocked) 327 .otherwise(_cutPeeps) 328 329 // WHAT PERCENT OF PEEPS ARE NOW ANGRY??? 330 var peeps = d.scene.world.peeps; 331 var angry = peeps.filter(function(peep){ 332 return(peep._CLASS_=="AngryPeep"); 333 }); 334 var angryRatio = angry.length/(peeps.length-1); 335 // angryRatio = 0.95; // HACK TO SKIP 336 337 // MORE THAN 66%: BRING IN THE PEACE PROTESTERS 338 if(angryRatio>0.5){ 339 _addProtesters(); 340 } 341 342 // ONCE (ALMOST) EVERYONE IS ANGRY, IT'S TIME FOR MURDER 343 if(angryRatio==1.00){ // EXACTLY 1. 344 Stage_Evil(self); // Next stage 345 } 346 347 } 348 }; 349 350} 351 352 353//////////////////////////////////////////////// 354//////////////////////////////////////////////// 355///////////// THE FINAL MANIFESTO ////////////// 356//////////////////////////////////////////////// 357//////////////////////////////////////////////// 358 359var _manifestoIndex = -1; 360var _manifesto = textStrings["manifesto"]; 361function _spoutManifesto(){ 362 if(_manifestoIndex<_manifesto.length-1){ 363 _manifestoIndex++; 364 } 365 return _manifesto[_manifestoIndex]; 366} 367 368 369 370 371//////////////////////////////////////////// 372//////////////////////////////////////////// 373///////////// THE FINAL THANG ////////////// 374//////////////////////////////////////////// 375//////////////////////////////////////////// 376 377function _chyAngry(d){ 378 var p = d.photoData; 379 var caught = d.caught({ 380 shocked: {_CLASS_:"NormalPeep", shocked:true}, 381 angry: {_CLASS_:"AngryPeep", returnAll:true}, 382 angryCircleShouting: {_CLASS_:"AngryPeep", type:"circle", isShouting:true, returnAll:true}, 383 angrySquareShouting: {_CLASS_:"AngryPeep", type:"square", isShouting:true, returnAll:true}, 384 }); 385 if(caught.angry.length>0){ 386 387 if(caught.angryCircleShouting.length+caught.angrySquareShouting.length>0){ 388 389 p.audience = 2; 390 p.caughtAngry = true; 391
392 // How many angrys? (*AFTER* you add 4 more...) 393 var peeps = d.scene.world.peeps; 394 var angry = peeps.filter(function(peep){ 395 return(peep._CLASS_=="AngryPeep"); 396 }); 397 var angriesAfterwards = angry.length+4; 398 var angryRatio = angriesAfterwards/(peeps.length-1); 399 400 if(angryRatio>=1){ 401 d.chyron = textStrings["everyoneHates"]; 402 }else if(angryRatio>=0.75){ 403 d.chyron = textStrings["almostEveryoneHates"]; 404 }else{ 405 406 // Who was caught angry & shouting? 407 if(caught.angryCircleShouting.length>0) p.caughtAngryCircle=true; 408 if(caught.angrySquareShouting.length>0) p.caughtAngrySquare=true; 409 410 if(caught.angryCircleShouting.length==0){ 411 d.chyron = textStrings["squaresHateCircles"]; // must be a square 412 }else{ 413 d.chyron = textStrings["circlesHateSquares"]; // must be a circle, or both 414 } 415 416 } 417 418 }else{ 419 if(caught.shocked){ 420 d.chyron = textStrings["justMissed"]; 421 }else{ 422 // d.chyron = textStrings["areTheyYelling"]; 423 d.chyron = textStrings["areTheyYelling"]; 424 } 425 } 426 return true; 427 } 428 return false; 429} 430 431function _chyHelping(d){ 432 var p = d.photoData; 433 var caught = d.caught({ 434 helping: {_CLASS_:"HelpingAnim"} 435 }); 436 if(caught.helping){ 437 if(caught.helping.hasHelped){ 438 d.chyron = _spoutManifesto(); 439 }else{ 440 d.chyron = textStrings["nerdsNow"]; 441 } 442 return true; 443 } 444 return false; 445} 446 447function _chyProtest(d){ 448 var p = d.photoData; 449 var caught = d.caught({ 450 protest: {_CLASS_:"ProtestAnim"} 451 }); 452 if(caught.protest) d.chyron = _spoutManifesto(); 453 return caught.protest; 454} 455 456function _chyWeirdo(d){ 457 var p = d.photoData; 458 var caught = d.caught({ 459 happyWeirdo: {_CLASS_:"HappyWeirdoPeep"}, 460 lovers: {_CLASS_:"LoverPeep"} 461 }); 462 if(caught.happyWeirdo){ 463 d.chyron = _spoutManifesto(); 464 return true; 465 } 466 if(caught.lovers){ 467 d.chyron = _spoutManifesto(); 468 return true; 469 } 470 return false; 471} 472 473function _chyShocked(d){ 474 var p = d.photoData; 475 var caught = d.caught({ 476 shocked: {_CLASS_:"NormalPeep", shocked:true} 477 }); 478 if(caught.shocked) d.chyron = textStrings["schockedPeep"]; 479 return caught.shocked; 480} 481 482function _cutAngry(d){ 483 484 var p = d.photoData; 485 if(p.caughtAngry){ 486 487 d.audience_cutToTV(); 488 489 // Make ALL the watching normal peeps angry 490 var world = d.scene.world; 491 var peeps = world.peeps; 492 peeps.filter(function(p){ 493 return (p._CLASS_=="NormalPeep" && p.isWatching); 494 }
494).forEach(function(peep){ 495 var newPeep = new AngryPeep(d.scene, peep.type); 496 world.replacePeep(peep, newPeep); 497 newPeep.watchTV(); 498 }); 499 500 return true; 501 } 502 return false; 503 504} 505function _cutHelping(d){ 506 return false; 507} 508function _cutProtest(d){ 509 return false; 510} 511function _cutWeirdo(d){ 512 return false; 513} 514function _cutShocked(d){ 515 return false; 516} 517 518//////////////////////////////////////////// 519//////////////////////////////////////////// 520//////////////////////////////////////////// 521//////////////////////////////////////////// 522//////////////////////////////////////////// 523//////////////////////////////////////////// 524 525 526function Stage_Whatever(self){ 527 528 // HACK - The snobby one 529 /* 530 if(HACK){ 531 var snobby = new SnobbyPeep(self); 532 self.world.addPeep(snobby); 533 snobby.HACK_JUMPSTART(); 534 } 535 */ 536 537 // Director 538 self.director.callbacks = { 539 takePhoto: function(d){ 540 d.chyron = textStrings["whatever"]; 541 }, 542 movePhoto: function(d){ 543 d.audience_movePhoto(); 544 }, 545 cutToTV: function(d){ 546 d.audience_cutToTV(); 547 } 548 }; 549 550}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.