Fix hair, dick around with new game screen.
[18plus-7leafadventure.git] / src / org / sevenchan / dongs / Creature.as
blob23e713a48e8e8e4363dfe7fa50404d76947fd225
1 package org.sevenchan.dongs
3 import flash.net.*;
4 import org.sevenchan.AdventureController;
5 import org.sevenchan.dongs.bodyparts.*;
6 import org.sevenchan.dongs.clothing.Clothing;
7 import org.sevenchan.dongs.clothing.ClothingType;
8 import org.sevenchan.dongs.creature.*;
9 import org.sevenchan.dongs.enchantment.*;
10 import org.sevenchan.dongs.enchantment.events.*;
11 import org.sevenchan.dongs.screens.*;
12 import org.sevenchan.dongs.weapons.IWeapon;
14 /**
15 * It's alive!
16 * @author Harbinger
18 public class Creature
20 registerClassAlias("ECreature", Creature);
22 // Characteristics
23 public var customized:Boolean = false;
24 public var ownName:String = "Blah Blah"; // Who am I?
25 public var height:Number = 0.0; // How tall am I?
26 public var build:Build = Build.AVG; // How fat am I?
27 public var material:Material = Material.NO_MATERIAL_MODIFIER; // What am I made of?
28 public var _hair:Hair = new Hair("bald",""); // His/her/hir hair is...
29 public var skin:Skin = new Skin("human"); // His/her/hir hair is...
30 public var _gender:Gender = Gender.ASEXUAL; // Boy, Girl, Neither, Both?
31 public var sexualPreference:SexualPreference = SexualPreference.ASEXUAL; // Straight, Gay, ASexual, Bi?
33 private var mGenderInitialized:Boolean = false;
35 // Stats (CACHED VALUES)
36 public var _level:int = 0; // In comparison to standard human being. No attacking rats for 20 levels.
37 private var d_level:int = 0; // Delta
38 public var _strength:int = 1; // Damage caused in case of a successful attack.
39 public var _speed:int = 1; // Chance of dodging [0-1]. defending.speed-attacking.speed = relative chance of dodging.
40 public var _intellect:int = 1; // Smartness. Opens dialog trees and gives hints.
41 public var _lust:int = 1; // Slowly increases over time, eliminated by masturbation or smecks. Some battles are nonsexual and will not affect lust, others will slightly increase it based on ((number of balls x ball hormone output)+(number of vaginas * vagina hormone output)* sensitivity).
42 public var _sensitivity:Number = 0; // 0-1, 0 being not sensitive
43 public var _HP:int = 100; //100*(level*0.02)
44 public var _XP:int = 0; // 50*(level*0.5)
45 public var _mana:int = 0; // Magic shit, increases over time, especially near relaxing places.
46 public var _gold:int = 0; // Currency
49 // Collections
50 // What magic/techniques can I use?
51 public var _abilities:Object = new Object();
52 // How many, and what type of assholes do I possess?
53 public var _assholes:Vector.<Asshole> = new Vector.<Asshole>();
54 // Needed to attack. Tentacles are ok.
55 public var _arms:Vector.<Arm> = new Vector.<Arm>();
56 // Testes (Cum and pregnancy options)
57 public var _balls:Vector.<Testicle> = new Vector.<Testicle>();
58 // Boobs (fuckable)
59 public var _breasts:Vector.<Breast> = new Vector.<Breast>();
60 // Penises (Pleasure options, testes required for preggo/cum stuff)
61 public var _dicks:Vector.<Penis> = new Vector.<Penis>();
62 // What kinds of effects am I suffering/benefiting from?
63 public var enchantments:Object = new Object();
64 // How many/what kinds of eyes do I have?
65 public var _eyes:Vector.<Eye> = new Vector.<Eye>();
66 // What stuff am I carrying?
67 public var inventory:Vector.<Item> = new Vector.<Item>();
68 // Legs or locomotive tentacles or some other propulsion. (NONE = CAN'T MOVE OR DODGE)
69 public var _legs:Vector.<Leg> = new Vector.<Leg>();
70 // Places to put babies if the "father" has a penis and doesn't know the FALCON PUNCH. Anal pregnancy is okay but only with dicks with that flag.
71 public var _vaginas:Vector.<Vagina> = new Vector.<Vagina>();
72 // For flight.
73 public var _wings:Vector.<Wing> = new Vector.<Wing>();
74 // Explored locations
75 public var explored:Vector.<String> = new Vector.<String>();
77 public var clothing:Vector.<Clothing> = new Vector.<Clothing>();
79 /**
80 * Do stats scale with the PC (false) or stay the same (true)?
81 * Mostly useful for bosses.
83 public var staticStats:Boolean = false;
85 public var main:AdventureController = null;
87 protected var abilityUseProbability:Number = 1;
88 protected var turnsToLose:int = 0;
90 public function Creature()
92 trace("Creature.init()");
93 clearFuckingEverything();
95 _gold = MathUtils.rand(0, 50);
96 _mana = maxMana;
99 /**
100 * IF YOU ADD ANY NEW VARIABLES TO THIS CLASS, RESET THEM TO DEFAULT VALUES HERE!
102 private function clearFuckingEverything():void {
103 _level = 0; // In comparison to standard human being. No attacking rats for 20 levels.
104 d_level = 0; // Delta
105 _strength = 1; // Damage caused in case of a successful attack.
106 _speed = 1; // Chance of dodging [0-1]. defending.speed-attacking.speed = relative chance of dodging.
107 _intellect = 1; // Smartness. Opens dialog trees and gives hints.
108 _lust = 1; // Slowly increases over time, eliminated by masturbation or smecks. Some battles are nonsexual and will not affect lust, others will slightly increase it based on ((number of balls x ball hormone output)+(number of vaginas * vagina hormone output)* sensitivity).
109 _sensitivity = 0; // 0-1, 0 being not sensitive
110 _HP = 100; //100*(level*0.02)
111 _XP = 0; // 50*(level*0.5)
112 _mana = 0; // Magic shit, increases over time, especially near relaxing places.
113 _gold = 0; // Currency
115 _abilities = new Object();
116 _assholes = new Vector.<Asshole>();
117 _arms = new Vector.<Arm>();
118 _balls = new Vector.<Testicle>();
119 _breasts = new Vector.<Breast>();
120 _dicks = new Vector.<Penis>();
121 enchantments = new Object();
122 _eyes = new Vector.<Eye>();
123 inventory = new Vector.<Item>();
124 _legs = new Vector.<Leg>();
125 _vaginas = new Vector.<Vagina>();
126 _wings = new Vector.<Wing>();
127 explored = new Vector.<String>();
128 clothing = new Vector.<Clothing>();
131 public function addBreast():Breast
133 trace("USING CREATURE.ADDBREAST INSTEAD OF OVERRIDING");
134 return null;
138 * IT'S A TRAP
139 * @return What the gender LOOKS like, given what you can see with clothing.
141 public function getApparentGender():Gender
143 var canSeeDick:Boolean = false;
144 var canSeeBalls:Boolean = false;
145 var canSeeBoobs:Boolean = false;
146 var canSeeVag:Boolean = false;
148 for each (var d:Penis in dicks)
150 if (d == null)
151 continue;
152 if (!d.isConcealedBy(this, clothing))
154 trace(d.getDescr(1, this), "gave", getTypeName(), "away");
155 canSeeDick = true;
156 break;
160 for each (var t:Testicle in balls)
162 if (t == null)
163 continue;
164 if (!t.isConcealedBy(this, clothing))
166 trace(t.getDescr(1, this), "gave", getTypeName(), "away");
167 canSeeBalls = true;
168 break;
172 for each (var b:Breast in breasts)
174 if (b == null)
175 continue;
176 if (!b.isConcealedBy(this, clothing))
178 trace(b.getDescr(1, this), "gave", getTypeName(), "away");
179 canSeeBoobs = true;
180 break;
184 for each (var v:Vagina in vaginas)
186 if (v == null)
187 continue;
188 if (!v.isConcealedBy(this, clothing))
190 trace(v.getDescr(1, this), "gave", getTypeName(), "away");
191 canSeeVag = true;
192 break;
195 var masc:Boolean = canSeeDick || canSeeBalls;
196 var fem:Boolean = canSeeBoobs || canSeeVag;
197 if (masc && fem)
198 return Gender.HERM;
199 if (masc && !fem)
200 return Gender.MALE;
201 if (!masc && fem)
202 return Gender.FEMALE;
203 return Gender.MALE;
206 public function breastDelta(delta:Number, mult:Boolean):void
208 for (var i:int = 0; i < _breasts.length; i++)
209 if (!mult)
210 _breasts[i].size += (delta);
211 else
212 _breasts[i].milkMult
215 public function dickDelta(delta:Number, mult:Boolean):void
217 for (var i:int = 0; i < _dicks.length; i++)
218 if (mult)
219 _dicks[i].sizeMult += (delta);
220 else
221 _dicks[i].size += (delta);
224 public function testicleDelta(delta:Number, mult:Boolean):void
226 for (var i:int = 0; i < _balls.length; i++)
227 if (mult)
228 _balls[i].loadMult += (delta);
229 else
230 _balls[i].normalLoad += (delta);
233 public function addEnchantment(ench:Enchantment):String
235 var story:String = ench.onInit(this);
236 if (!ench.cancelAddition)
237 this.enchantments[ench.getID()] = ench;
238 return story;
241 public function setupBody():void
243 initialGenderSetup();
244 CONFIG::debug
246 if (this._arms.length == 0)
247 trace("[WARNING] ", this.getTypeName(), " has no arms!");
248 if (this._assholes.length == 0)
249 trace("[WARNING] ", this.getTypeName(), " has no anuses!");
250 if (this._gender.hasDick && this._balls.length == 0)
251 trace("[WARNING] ", this.getTypeName(), " has no balls!");
252 if (this._breasts.length == 0)
253 trace("[WARNING] ", this.getTypeName(), " has no breasts!");
254 if (this._gender.hasDick && this._dicks.length == 0)
255 trace("[WARNING] ", this.getTypeName(), " has no dick!");
256 if (this._eyes.length == 0)
257 trace("[WARNING] ", this.getTypeName(), " has no eyes!");
258 if (this._legs.length == 0)
259 trace("[WARNING] ", this.getTypeName(), " has no legs!");
260 if (this._gender.hasVag && this._vaginas.length == 0)
261 trace("[WARNING] ", this.getTypeName(), " has no vag!");
265 public function initialGenderSetup():void
267 mGenderInitialized = true;
270 public function yourMove(cs:CombatScreen, ply:Creature):void
272 if ((turnsToLose > 0) || notifyEnchantments(new CombatTurnEvent(cs, ply)))
274 InfoScreen.push("<p>The " + getTypeName() + " cannot attack!</p>");
275 return;
277 if (turnsToLose > 0)
279 turnsToLose--;
281 if (MathUtils.lengthOf(abilities) > 0 && MathUtils.rand(0, abilityUseProbability) == 0)
283 var ab:Ability = Ability(MathUtils.getRandomObjectEntry(abilities));
284 if (this.mana < ab.manaCost)
286 InfoScreen.push("<p>The " + getTypeName() + " tried to use " + ab.name + " but is too exhausted!</p>");
287 return;
289 if (ab.activate(this, ply))
291 this.mana -= ab.manaCost
292 return;
295 cs.tryAttack(this, ply);
296 return;
299 public function addDick(type:String = "default"):Penis
301 return null;
304 public function addLust(amt:Number = 1):void
306 var adding2Lust:int = (amt * getLustMult());
307 trace("Adding to lust ", adding2Lust);
308 lust += Math.ceil(adding2Lust);
311 private function getLustMult():Number
313 var numballs:Number = balls.length;
314 var loadMultSum:Number = 0;
315 for (var i:int = 0; i < balls.length; i++)
317 loadMultSum += (balls[i] as Testicle).loadMult * 0.5;
319 return loadMultSum;
322 public function takeFromInventory(item:Item):void
324 for (var i:int = 0; i < inventory.length; i++)
326 if ((inventory[i] as Item).id == item.id)
328 (inventory[i] as Item).amount -= item.amount;
329 if ((inventory[i] as Item).amount <= 0)
330 inventory.splice(i, 1);
331 return;
336 public function addToInventory(item:Item):void
338 for (var i:int = 0; i < inventory.length; i++)
340 if ((inventory[i] as Item).id == item.id)
342 (inventory[i] as Item).amount += item.amount;
343 return;
346 if (inventory.length < 11)
348 inventory.push(item);
350 else
352 if (main != null)
353 main.showInventory(item);
357 public function combatDescr(subj:Creature):String
359 if (getInterested(subj))
361 this.lust = 100;
363 var o:String = "<p>" + Utils.A(getTypeName(), true) + " " + getTypeName() + " leaps from the bushes and attacks!</p><p>Your attacker is ";
364 o += getDescription();
366 return o;
369 public function onEncounter(ply:Creature):Boolean
371 return false;
374 public function onWin(ply:Creature):Boolean
376 return false;
380 * Override this and return true to override the default "YOU WHIN TEH PRIZE!!!!" screen
381 * @param ply
382 * @return
384 public function onLose(ply:Creature):Boolean
386 return false;
389 protected function genName():void
391 var firstNames:Array = ["Andrew", "Alex", "Boris", "Charles", "Alexei", "Drew", "Scruffy", "Gonnadi", "Adolf", "Albert", "Bruno", "Frederick", "Ray"];
393 var lastNames:Array = ["Lenin", "Hitler", "Jenkins", "Balboa", "Nelson", "O'Reilly", "McDonald", "Charles", "Rubin", "Schwarzeneggar"];
394 ownName = MathUtils.getRandomArrayEntry(firstNames) + " " + MathUtils.getRandomArrayEntry(lastNames);
395 //trace(ownName);
398 public function recalcGender():void
400 if (balls.length > 0)
402 if (vaginas.length > 0)
404 gender = Gender.HERM;
406 else
408 gender = Gender.MALE;
411 else
413 if (vaginas.length > 0)
415 gender = Gender.FEMALE;
417 else
419 gender = Gender.ASEXUAL;
425 * What am I?
426 * @return String Whatever it's called
428 public function getTypeName():String
430 throw new Error("SOME DUMBASS DIDN'T GIVE THIS CREATURE A NAME");
431 return "NOT FUCKING NAMED YET";
435 * Do I have the option to run?
436 * @return Button visibility
438 public function canRun():Boolean
440 return true;
443 public function areAnyConcealed(parts:Vector.<IBodyPart>):Boolean
445 var yes:Boolean = false;
446 for each (var p:IBodyPart in parts)
448 if (p != null && p.isConcealedBy(this, clothing))
449 return true;
451 return false;
454 public function isHeadConcealed():Boolean
456 var wat:Function = function(c_:Object, index:int, vector:Vector.<Clothing>):Boolean
458 var c:Clothing = Clothing(c_);
459 if (c != null)
460 return (c.type.obscures.indexOf("head") > -1);
461 else
462 return false;
464 return clothing.some(wat);
467 public function isWearing(ct:ClothingType):Boolean
469 var wat:Function = function(c_:Object, index:int, vector:Vector.<Clothing>):Boolean
471 var c:Clothing = Clothing(c_);
472 if (c != null)
473 return (c.type == ct);
474 else
475 return false;
477 return clothing.some(wat);
480 public function areEyesConcealed():Boolean
482 return areAnyConcealed(Vector.<IBodyPart>(eyes));
485 public function getDescription():String
487 var descr:String = "";
488 // a gay human male of average height and build. He also possesses a long, flowing mane of golden hair,
489 // which contrasts nicely with your blue eyes and light skin.
491 // In the equipment department, you're not too odd. You have two human testicles swinging between your legs, paired with
492 // a single, 5.5" human schlong. Your breasts are flat, but well-sculpted human pecs, and you have a standard-issue male
493 // ass with a standard-issue virgin male asshole between its buns. You've got two human arms, two human legs.
495 // In other words, you're an average human, which probably won't last long down here.
498 // NOW WITH ENEMY TRAPS
499 var aGender:Gender = getApparentGender();
500 descr = Utils.A(sexualPreference.label) + " " + aGender.label + " " + getTypeName() + ", who " + build.getDescription();
502 if (!isHeadConcealed())
504 if (hair.isBald())
506 descr += ", %POS% glistening scalp";
507 if (!areEyesConcealed())
508 descr += " distracting from %POS%";
510 else
512 descr += ". %CSUB% has " + hair;
513 if (!areEyesConcealed())
514 descr += ", which constrasts nicely with %POS%";
517 else
519 descr += ", and has";
521 if (!areEyesConcealed())
523 if (eyes.length == 0)
525 if (isHeadConcealed())
526 descr += " a";
527 descr += " complete lack of eyes";
529 else
530 descr += getEyesDescr();
531 descr += " and "
534 descr += skin.getDescr(0, this);
535 descr += ".</p>";
537 descr += "<p>In the equipment department, ";
538 var wearingPants:Boolean = isWearing(ClothingType.PANTS);
539 var haveBalls:Boolean = (balls.length > 0 && !wearingPants);
540 var haveDicks:Boolean = (dicks.length > 0 && !wearingPants);
541 var haveVags:Boolean = (vaginas.length > 0 && !wearingPants);
542 if (haveBalls && haveDicks)
543 descr += "%SUB% has " + getTesticleDescr() + " swinging between %POS% legs, paired with " + getDickDescr() + ".";
544 if (!haveBalls && haveDicks)
545 descr += "no testicles rub between %POS% thighs when %SUB% walks, but %SUB% does have " + getDickDescr() + ".";
546 if (haveBalls && !haveDicks)
547 descr += "%SUB% doesn't have a dick, but %SUB% does have " + getTesticleDescr() + ". %SUB% seems to get more horny as time passes.";
549 if (haveVags)
550 descr += " %CPOS% body possesses " + getVagDescr() + ".";
552 if (!haveBalls && !haveDicks && !haveVags )
554 descr += " You can't see any dangly parts, nor anything else between %POS% legs.";
555 if (breasts.length > 0)
556 descr += " However, ";
559 if (breasts.length > 0)
561 descr += " %CSUB% has " + getBreastDescr();
562 if (assholes.length > 0 && !areAnyConcealed(Vector.<IBodyPart>(assholes)))
564 descr += ", and also has " + getAssDescr() + ".";
566 else
568 descr += ".";
571 else
573 descr += " %CSUB% doesn't have any breasts";
574 if (assholes.length > 0 && !areAnyConcealed(Vector.<IBodyPart>(assholes)))
576 descr += ", but does have " + getAssDescr() + ".";
579 else
581 descr += ".";
585 if (arms.length > 0)
586 descr += " %CSUB% has " + getArmsDescr() + ", ";
587 else
588 descr += " %CSUB% doesn't have any arms, ";
590 if (legs.length > 0)
592 if (arms.length == 0)
593 descr += "but %SUB% DOES have ";
594 else
595 descr += "and ";
596 descr += getLegsDescr() + ".";
598 else
599 descr += "and no legs.";
601 if (wings.length > 0)
603 descr += " %CSUB% also has " + getWingsDescr() + ".";
606 descr += "</p>";
608 descr += "<p>%CSUB% is wearing " + ((clothing.length > 0) ? "a " + getClothingDescr() : "nothing") + ".</p>";
609 if (aGender.label != gender.label)
610 descr += "<p><small>DEBUG: %CSUB% is actually a " + gender.label + " with " + getDickDescr() + "/" + getTesticleDescr() + "/" + getVagDescr() + ". TEE HEE.</small></p>";
612 return aGender.doReplace(descr);
615 public function hasEnchantment(name:String):Boolean
617 return Utils.objHas(enchantments, name);
620 public function levelUp(firstOne:Boolean = false):void
622 _level++;
623 if (!firstOne)
624 InfoScreen.push("<h2>Levelled up!</h2><p>You are now at level " + level + "!</p>");
627 public function onCombatInit(ply:Player):void
629 HP = this.maxHP;
632 public function get maxMana():int
634 return 100 + ((level - 1) * 10);
637 public function get maxHP():int
639 return 100 + ((level - 1) * 10);
642 public function get maxXP():int
644 return Math.max(1, 50 * (_level * 0.5));
647 public function getExplored(loc:String):Boolean
649 for (var i:int = 0; i < explored.length; i++)
651 if (explored[i] == loc)
652 return true;
654 return false;
657 public function setExplored(loc:String):void
659 if (getExplored(loc))
660 return;
661 explored.push(loc);
664 public function getEffectivenessMultiplier(defender:Creature):Number
666 var a:Number = strength;
667 var e:Number = defender.strength;
668 return (a * (100 - e)) / 10000;
672 * Calculation from http://www.gamedev.net/topic/183822-rpg-combat-formula-question/
673 * @param attacker
675 public function speedCheckAgainst(attacker:Creature):Boolean
677 // C = A * (100% - E)
678 // WHERE
679 // C = Chance to hit
680 // A = Attacker's accuracy (speed, in our case)
681 // E = Defender's evasion rate (speed, again)
682 var a:Number = attacker.speed;
683 var e:Number = speed;
684 return Math.random() <= (a * (100 - e)) / 10000;
688 * Calculation from http://www.gamedev.net/topic/183822-rpg-combat-formula-question/
689 * @param attacker
691 public function strengthCheckAgainst(attacker:Creature):Boolean
693 var a:Number = attacker.strength;
694 var e:Number = strength;
695 // C = A * (100% - E)
696 // WHERE
697 // C = Chance to hit
698 // A = Attacker's accuracy (strength, in our case)
699 // E = Defender's evasion rate (strength, again)
700 return Math.random() <= (a * (100 - e)) / 10000;
704 * Figure out how much shit we're going to wreck.
705 * @param attacker
706 * @param weapon or null
707 * @return
709 public function damageAgainst(attacker:Creature, weapon:IWeapon):Number
711 // from D&D?
712 // TODO: Probably need to factor in speed or something at some point. I ain't a math guy.
713 var a:Number = attacker.strength;
714 var e:Number = strength;
715 var weaponDamage:Number = 0;
716 if (weapon != null)
717 weaponDamage = weapon.calcDamage(this, attacker);
718 var dmg:Number = (MathUtils.rand(0, 1, false) + level + (strength / 50) + weaponDamage) - (MathUtils.rand(0, 1, false) + attacker.level + (attacker.strength / 50));
719 dmg *= 10;
720 return Math.ceil((dmg > 0) ? dmg : 1); // Keep above 1 (no negatives, no 0-damage attacks.)
723 public function get strength():int
725 return _strength;
728 public function set strength(str:int):void
730 _strength = str;
731 doStatsUpdate();
734 public function get speed():int
736 return _speed;
739 public function set speed(spd:int):void
741 _speed = spd;
742 doStatsUpdate();
745 public function get lust():int
747 return _lust;
750 public function set lust(lst:int):void
752 _lust = lst;
753 if (_lust > 100)
754 _lust = 100;
755 doStatsUpdate();
758 public function get gold():int
760 return _gold;
763 public function set gold(value:int):void
765 if (value < 0)
766 value = 0;
767 _gold = value;
768 doStatsUpdate();
771 public function get intellect():int
773 return _intellect;
776 public function set intellect(i:int):void
778 _intellect = i;
779 doStatsUpdate();
782 public function get mana():int
784 return _mana;
787 public function set mana(i:int):void
789 _mana = i;
790 doStatsUpdate();
793 public function get sensitivity():int
795 return _sensitivity;
798 public function set sensitivity(i:int):void
800 _sensitivity = i;
801 doStatsUpdate();
804 public function get assholes():Vector.<Asshole>
806 return this._assholes;
809 public function set assholes(balls:Vector.<Asshole>):void
811 this._assholes = balls;
812 customized = true;
815 public function hasItem(id:int):Boolean
817 for each (var item:Item in this.inventory)
819 if (item.id == id)
820 return true;
822 return false;
825 public function get breasts():Vector.<Breast>
827 return this._breasts;
830 public function set breasts(balls:Vector.<Breast>):void
832 this._breasts = balls;
833 customized = true;
836 public function get eyes():Vector.<Eye>
838 return this._eyes;
841 public function set eyes(balls:Vector.<Eye>):void
843 this._eyes = balls;
844 customized = true;
847 public function get vaginas():Vector.<Vagina>
849 return this._vaginas;
852 public function set vaginas(balls:Vector.<Vagina>):void
854 this._vaginas = balls;
855 customized = true;
858 public function get arms():Vector.<Arm>
860 return _arms;
863 public function set arms(arr:Vector.<Arm>):void
865 _arms = arr;
866 customized = true;
869 public function get legs():Vector.<Leg>
871 return _legs;
874 public function set legs(arr:Vector.<Leg>):void
876 _legs = arr;
877 customized = true;
880 public function get wings():Vector.<Wing>
882 return _wings;
885 public function set wings(arr:Vector.<Wing>):void
887 _wings = arr;
888 customized = true;
891 public function get balls():Vector.<Testicle>
893 return _balls;
896 public function set balls(balls:Vector.<Testicle>):void
898 _balls = balls;
899 customized = true;
902 public function get dicks():Vector.<Penis>
904 return _dicks;
907 public function set dicks(aaa:Vector.<Penis>):void
909 _dicks = aaa;
910 customized = true;
913 public function get abilities():Object
915 return _abilities;
918 public function set abilities(arr:Object):void
920 _abilities = arr;
923 public function get gender():Gender
925 return _gender;
928 public function set gender(value:Gender):void
930 _gender = value;
931 customized = true;
934 public function get HP():int
936 return _HP;
939 public function set HP(value:int):void
941 _HP = value;
942 doStatsUpdate();
945 public function get XP():int
947 return _XP;
950 public function set XP(value:int):void
952 //trace("XP", value);
953 _XP = value;
954 if (_XP >= maxXP)
956 _XP = 0;
957 levelUp();
959 doStatsUpdate();
962 public function setMain(main:AdventureController):void
964 this.main = main;
967 private function doStatsUpdate():void
969 if (main != null)
971 main.refreshStats();
973 else
975 // AI
976 if (_eyes.length == 0)
977 _speed = 0.1; // 1/10 chance of hitting when blind
981 public function get level():int
983 return _level;
986 private function getBodyPartDesc(collection:Vector.<IBodyPart>, singular:String):String
989 if (collection.length == 0)
991 return "no " + Utils.pluralize(2, singular);
993 var out:String = "";
994 var varying:Boolean = false;
995 var types:Object = new Object();
996 var lname:String = "";
997 var numtypes:Number = 0;
998 for each (var i:*in collection)
1000 var t:IBodyPart = i as IBodyPart;
1001 if (t == null)
1002 continue;
1003 //trace(t);
1004 lname = t.name;
1005 if (!(lname in types))
1007 types[lname] = 0;
1008 numtypes++;
1010 types[lname]++;
1012 if (numtypes == 1)
1014 for each (t in collection)
1016 if (t.name == lname)
1017 return t.getDescr(types[lname], this);
1020 else
1022 var n:Number = 0;
1023 for (var ot:*in types)
1025 var gotdescr:Boolean = false;
1026 for each (t in collection)
1028 if (t.name == ot)
1030 if (!gotdescr)
1032 out += ", " + t.getDescr(types[ot] as Number, this);
1033 gotdescr = true;
1035 n += types[ot];
1039 return collection.length + " " + singular + "s of varying types (" + out.substr(2) + ")";
1041 return "";
1044 public function notifyEnchantments(e:*):Boolean
1046 var collection:Array = [];
1047 for (var eID:String in enchantments)
1049 var ench:Enchantment = enchantments[eID];
1050 if (e is CombatStartEvent)
1052 ench.onCombatInit(e.other);
1054 if (e is CombatEndEvent)
1056 ench.onCombatComplete(e.won, e.other);
1058 if (e is CombatTurnEvent)
1060 return ench.onMyCombatTurn(e.screen, e.other);
1063 return false;
1066 public function inventoryUpdate(item:Item, received:Boolean):Boolean
1068 var actionToTake:int = -1;
1069 for (var eID:String in enchantments)
1071 var act:int = enchantments[eID].onInventoryReceived(item);
1072 if (act != Enchantment.INTERCEPT_ACTION_NONE)
1074 actionToTake = act;
1075 break;
1078 switch (actionToTake)
1080 case Enchantment.INTERCEPT_ACTION_TOSS:
1081 // Do nothing, we're already tossing.
1082 break;
1083 case Enchantment.INTERCEPT_ACTION_USE:
1084 item.Use(this);
1085 break;
1086 default:
1087 break;
1089 return actionToTake == Enchantment.INTERCEPT_ACTION_NONE;
1092 public function getTesticleDescr():String
1094 return getBodyPartDesc(Vector.<IBodyPart>(balls), "ball");
1097 public function getBulgesInPants():String
1099 var numBulge:int = 0;
1100 var peeks:Vector.<Penis> = new Vector.<Penis>();
1101 for each (var p:Penis in dicks)
1103 if (p == null)
1104 continue;
1105 if (!p.isConcealedBy(this, clothing))
1107 for each (var c:Clothing in clothing)
1109 if (c == null)
1110 continue;
1111 var bsize:Number = p.getBulgeSize(this, c);
1112 trace(p.getDescr(1, this), "bsize=" + bsize.toString());
1113 if (bsize > 6)
1115 if (bsize < 8)
1117 numBulge++;
1119 else
1121 peeks.push(p)
1127 if (numBulge == 0 && peeks.length == 0)
1128 return "";
1129 var fo:String = " (which has ";
1130 if (numBulge > 0)
1132 fo += numBulge + " " + Utils.pluralize(numBulge, "bulge", "bulges");
1134 if (numBulge > 0 && peeks.length > 0)
1136 fo += " and ";
1138 if (peeks.length > 0)
1140 fo += getBodyPartDesc(Vector.<IBodyPart>(peeks), "dick") + " peeking over %POS% waistband";
1142 return fo + ")";
1145 public function getDickDescr():String
1147 return getBodyPartDesc(Vector.<IBodyPart>(dicks), "dick");
1150 public function getVagDescr():String
1152 return getBodyPartDesc(Vector.<IBodyPart>(vaginas), "vag");
1155 public function getBreastDescr():String
1157 return getBodyPartDesc(Vector.<IBodyPart>(breasts), "boob");
1160 public function getAssDescr():String
1162 return getBodyPartDesc(Vector.<IBodyPart>(assholes), "asshole");
1165 public function getArmsDescr():String
1167 return getBodyPartDesc(Vector.<IBodyPart>(arms), "arm");
1170 public function getEyesDescr():String
1172 return getBodyPartDesc(Vector.<IBodyPart>(eyes), "eye");
1175 public function getLegsDescr():String
1177 return getBodyPartDesc(Vector.<IBodyPart>(legs), "leg");
1180 public function getWingsDescr():String
1182 return getBodyPartDesc(Vector.<IBodyPart>(wings), "wing");
1185 public function getClothingDescr():String
1187 var desc:String = "";
1189 for (var i:int = 0; i < clothing.length; i++)
1191 var item:Clothing = clothing[i];
1193 desc += item.getDescr(this);
1195 switch (item.type)
1197 case ClothingType.HEADGEAR:
1198 desc += " as a hat";
1199 break;
1200 case ClothingType.TOP:
1201 desc += " as a shirt";
1202 break;
1203 case ClothingType.FOOTWEAR:
1204 desc += " as shoes";
1205 break;
1206 case ClothingType.PANTS:
1207 desc += " as trousers" + getBulgesInPants();
1208 break;
1211 if (i < (clothing.length - 3))
1213 desc += ", ";
1215 else if (i == (clothing.length - 2))
1217 desc += " and ";
1221 return desc;
1225 * Wants your body
1227 * I = Interested
1228 * H = Hostile
1229 * +---------------+---+---+
1230 * | Type | I | H |
1231 * +---------------+---+---+
1232 * | Rape | T | T |
1233 * | Fight | F | T |
1234 * | Horny | T | F |
1235 * | - | F | F |
1236 * +---------------+---+---+
1238 public function getInterested(subj:Creature):Boolean
1240 return sexualPreference.isOppositeGender(gender, subj.getApparentGender()); // trollface.jpg
1244 * By default, only allow rape if health == 0 or paralyzed.
1245 * @param rapist WHO BE RAPIN ME
1248 public function tryRape(rapist:Creature):Boolean
1250 return (HP == 0 || Paralyze.isParalyzed(this));
1254 public function getHostile(subj:Creature):Boolean
1256 return false;
1259 public function performConversion(oldMe:Creature):void
1264 public function changeFrom(f:Creature):void
1266 this.performConversion(f);
1269 public function loseTurns(numturns:int):void
1271 turnsToLose += numturns;
1274 public function getRapable():Boolean
1276 return canRun() && HP < (maxHP / 3);
1280 * Alter the rape menu to fit your needs.
1281 * @param ply
1282 * @param menu
1284 public function onRape(ply:Creature, rape:Rape):void
1290 * Does this character have any weapons?
1291 * @return
1293 public function hasAnyWeapon():Boolean {
1294 for (var i:int = 0; i < arms.length; i++) {
1295 if (arms[0].weapon != null)
1296 return true;
1298 return false;
1302 * Find any equipped weapon.
1303 * @return
1305 public function getFirstWeapon():IWeapon {
1306 for (var i:int = 0; i < arms.length; i++) {
1307 if (arms[0].weapon != null)
1308 return arms[0].weapon;
1310 return null;
1313 public function get hair():Hair { return _hair; }
1314 public function set hair(value:Hair):void { _hair=value; }