1 package org
.sevenchan
.dongs
.enchantment
3 import org
.sevenchan
.dongs
.Creature
;
4 import org
.sevenchan
.dongs
.Item
;
5 import org
.sevenchan
.dongs
.screens
.CombatScreen
;
6 import org
.sevenchan
.dongs
.screens
.InfoScreen
;
7 import flash
.net
.registerClassAlias
;
9 * Require user to obtain one or more items in order to fend off curse.
10 * - Forces use of item when obtained
11 * - If opponent has item, force either surrender or attack, depending on how to get the item
15 public class Hunger
extends Enchantment
18 registerClassAlias
("EHunger", Corruption
);
19 public var forWhat
:int = 0;
20 public var amount
:Number = 0;
21 private var host
:Creature
;
23 public function Hunger
(_forWhat
:int, _howMuch
:Number)
26 this.forWhat
= _forWhat
;
27 this.amount
= _howMuch
;
29 override public function onInit
(newHost
:Creature
):String
32 cancelAddition
= false;
33 this.item
= Item
.findByID
(forWhat
);
34 InfoScreen
.push
("<h2>Hunger</h2><p>You are now hungry for " + amount
+ " " + item
.name
+ ".</p><p>Check your appearance screen to see your effects.</p>");
35 return "You are now hungry."
37 override public function getName
():String
41 override public function getID
():String
46 override public function getDescr
():String
48 return "You are hungry for "+amount
+"x "+item
.name
+".";
51 private function haveItemsNeeded
():Boolean {
52 if (this.host
.hasItem
(forWhat
)) {
54 for each (var item
:Item
in this.host
.inventory
) {
55 if (item
.id
== forWhat
) {
56 if (item
.amount
>= amount
) {
65 override public function onMyCombatTurn
(screen
:CombatScreen
,other
:Creature
):Boolean
67 if (other
.hasItem
(forWhat
)) {
68 if (item
.isSexuallyTransmitted
) {
69 screen
.passAction
= CombatScreen
.PASS_SKIP
;
70 InfoScreen
.push
("<h2>Hunger</h2><p>You're too hungry to think about anything other than " + other
.getTypeName
() + "'s " + item
.name
+ "!</p>");
73 screen
.passAction
= CombatScreen
.PASS_SKIP
;
74 InfoScreen
.push
(other
.gender
.doReplace
("<h2>Hunger</h2><p>You're too hungry to think about anything other than " + other
.getTypeName
() + "'s " + item
.name
+ ", and viciously attack %CSUB%!</p>"));
82 override public function onInventoryReceived
(item
:Item
):int
84 if (item
.id
== this.item
.id
) {
86 return INTERCEPT_ACTION_USE
; // Eat? Drink? Who fucking cares
88 return super.onInventoryReceived
(item
);
91 private function remove
():void {
92 InfoScreen
.push
("<p>Your hunger subsides.</p>");
93 delete host
.enchantments
[getID
()];