1 package org
.sevenchan
.dongs
.creature
3 // import com.adobe.serialization.json.JSON;
4 import com
.adobe
.serialization
.json
.JSONEncoder
;
5 import flash
.events
.Event;
8 import org
.sevenchan
.AdventureController
;
9 import org
.sevenchan
.dongs
.*;
10 import org
.sevenchan
.dongs
.ability
.Instawin
;
11 import org
.sevenchan
.dongs
.bodyparts
.*;
12 import org
.sevenchan
.dongs
.creature
.npc
.NPC
;
13 import org
.sevenchan
.dongs
.screens
.CombatScreen
;
19 public class Player
extends Creature
21 private var f
:FileReference = new FileReference();
22 public var baseType
:Creature
= new Human
();
23 private var saveFile
:FileReference = null;
24 private var waitingForLoad
:Boolean = false;
25 private var cancelled
:Boolean = false;
26 public var currentTown
:Town
= Town
.knownTowns
["barn"];
28 public function Player
(main
:AdventureController
)
31 //trace("Player.init()");
35 override public function addBreast
():Breast
37 return baseType
.addBreast
();
40 override public function addDick
(type
:String = "default"):Penis
42 return baseType
.addDick
(type
);
45 public function changeTo
(t
:Creature
):void
47 var tmp
:Creature
= baseType
;
49 baseType
.ownName
= tmp
.ownName
;
50 baseType
._speed
= tmp
._speed
;
51 baseType
._strength
= tmp
._strength
;
52 baseType
.abilities
= tmp
.abilities
;
53 baseType
.enchantments
= tmp
.enchantments
;
54 baseType
.explored
= tmp
.explored
;
55 baseType
.gender
= tmp
.gender
;
56 baseType
.gold
= tmp
.gold
;
57 baseType
.height
= tmp
.height
;
58 baseType
.HP
= tmp
.maxHP
;
59 baseType
.ownName
= tmp
.ownName
;
60 baseType
.sensitivity
= tmp
.sensitivity
;
61 baseType
.sexualPreference
= tmp
.sexualPreference
;
62 baseType
.inventory
= tmp
.inventory
;
64 baseType
.performConversion
(tmp
);
67 override public function getExplored
(loc
:String):Boolean
69 for (var i
:int = 0; i
< baseType
.explored
.length
; i
++)
71 if (baseType
.explored
[i
] == loc
)
77 override public function setExplored
(loc
:String):void
81 baseType
.explored
.push
(loc
);
84 public function save
(slot
:int = -1):void
89 //baseType.ownName = ownName;
91 currentTown
: currentTown
.ID
,
96 var ba:ByteArray = new ByteArray();
97 ba.writeObject( savo );
98 ba.objectEncoding = ObjectEncoding.AMF3;
100 var json
:JSONEncoder
= new JSONEncoder
(savo
);
101 var f
:FileReference = new FileReference();
102 f
.save
(json
.getString
(), "save.7la");
106 var so
:SharedObject = SharedObject.getLocal
("7la_slot" + slot
.toString
());
107 so
.data
.currentTown
= currentTown
.ID
;
108 so
.data
.body
= baseType
;
109 so
.data
.npcs
= NPC
.instances
;
114 public function load
(slot
:int = -1):Boolean
118 waitingForLoad
= true;
119 f
.addEventListener
(Event.SELECT
, onFileSelected
);
120 f
.addEventListener
(Event.CANCEL
, onFileCancelled
);
121 if (!f
.browse
([new FileFilter("Saves", "*.7la")]))
127 var so
:SharedObject = SharedObject.getLocal
("7la_slot" + slot
.toString
());
128 currentTown
= Town
.knownTowns
[so
.data
.currentTown
];
129 baseType
= so
.data
.body
;
134 // Slot 1: Level 150 Bova in Horus's Spine
135 // [HP: 50, Lust: 50]
136 public static function previewSlot
(slot
:int):String
139 var so
:SharedObject = SharedObject.getLocal
("7la_slot" + slot
.toString
());
141 if (so
== null || so
.data
== null)
144 var t
:Town
= Town
.knownTowns
[so
.data
.currentTown
];
145 var c
:Creature
= so
.data
.body
;
146 if (t
== null || c
== null)
148 var o
:String = "Slot " + slot
+ ": "+c
.ownName
+", Level " + c
.level
+ " " + c
.getTypeName
() + " at " + t
.name
+ "<br />";
149 o
+= "[HP: " + c
.HP
+ ", Lust: " + c
.lust
+ "]";
152 trace
(e
.message
+ ": " + e
.getStackTrace
());
153 return "Slot "+slot
+": Corrupt/Outdated!";
158 private function onFileSelected
(e
:Event):void
160 f
.addEventListener
(Event.COMPLETE
, onFileLoaded
);
164 private function onFileLoaded
(e
:Event):void
166 //var saveData:Object = f.data.readObject();
167 var saveData
:Object = JSON
.stringify
(f
.data
.toString
());
168 this.currentTown
= Town
.knownTowns
[saveData
.currentTown
];
169 this.baseType
= saveData
.body
;
170 //ownName=baseType.ownName;
171 if (saveData
.hasOwnProperty
("npcs"))
173 for(var k
:Object in saveData
.npcs
){
174 NPC
.instances
[k
] = saveData
.npcs
[k
];
177 main
.onPlayerLoaded
();
180 private function onFileCancelled
(e
:Event):void
184 override public function initialGenderSetup
():void
186 baseType
.initialGenderSetup
();
189 override public function yourMove
(cs
:CombatScreen
, ply
:Creature
):void
193 public override function getDescription
():String
195 var descr
:String = "<h2>Appearance</h2>";
196 // You, Charles Cockhammer, are a gay human male of average height and build. You also possess a long, flowing mane of golden hair,
197 // which contrasts nicely with your blue eyes and light skin.
199 // In the equipment department, you're not too odd. You have two human testicles swinging between your legs, paired with
200 // a single, 5.5" human schlong. Your breasts are flat, but well-sculpted human pecs, and you have a standard-issue male
201 // ass with a standard-issue virgin male asshole between its buns. You've got two human arms, two human legs.
203 // In other words, you're an average human, which probably won't last long down here.
205 descr
+= "<p>You, " + baseType
.ownName
+ ", are " + Utils
.A
(baseType
.gender
.label
) + " " + baseType
.gender
.label
+ " " + baseType
.getTypeName
() + " whose body " + baseType
.build
.getDescription
() + "." + " You also possess " + baseType
.hair
.toString
();
207 if (baseType
.hair
== Hair
.BALD
)
208 descr
+= ", your glistening scalp distracting from your ";
210 descr
+= ", which constrasts nicely with your ";
211 if (baseType
.eyes
.length
== 0)
212 descr
+= " complete lack of eyes (<b>and resulting blindness</b>)";
214 descr
+= baseType
.getEyesDescr
();
216 descr
+= " and " + baseType
.skin
.getDescr
(0, this);
219 descr
+= "<p>In the equipment department, ";
220 //if (baseType.customized)
221 // descr += "you're a bit different from the average bear. ";
223 // descr += "you're not too odd, compared to other "+baseType.getTypeName()+"s. ";
224 var haveBalls
:Boolean = (baseType
.balls
.length
> 0);
225 var haveDicks
:Boolean = (baseType
.dicks
.length
> 0);
226 var haveVags
:Boolean = (baseType
.vaginas
.length
> 0);
227 if (haveBalls
&& haveDicks
)
228 descr
+= "You have " + baseType
.getTesticleDescr
() + " swinging between your legs, paired with " + baseType
.getDickDescr
() + ".";
229 if (!haveBalls
&& haveDicks
)
230 descr
+= "No testicles rub between your thighs when you walk, but you do have " + baseType
.getDickDescr
() + ".";
231 if (haveBalls
&& !haveDicks
)
232 descr
+= "You don't have a dick, but you do have " + baseType
.getTesticleDescr
() + ". <b>Because of a lack of an outlet for semen, you cannot masturbate, so your balls fill with semen, out of control.</b>";
235 descr
+= "Your body possesses " + baseType
.getVagDescr
() + ".";
237 if (!haveBalls
&& !haveDicks
&& !haveVags
)
238 descr
+= "You don't have any sexual organs, so you can't masturbate. On the bright side, you won't get horny, either.";
240 if (baseType
.breasts
.length
> 0)
241 descr
+= "You have " + baseType
.getBreastDescr
() + ", and you wear ";
243 descr
+= "You don't have any breasts, but you do have ";
244 descr
+= baseType
.getAssDescr
() + ".";
246 if (baseType
.arms
.length
> 0)
247 descr
+= "You have " + baseType
.getArmsDescr
() + ", ";
249 descr
+= "You don't have any arms (<b>and therefore can't attack</b>), ";
251 if (baseType
.legs
.length
> 0)
253 if (baseType
.arms
.length
== 0)
254 descr
+= "but you DO have ";
257 descr
+= baseType
.getLegsDescr
() + ".";
260 descr
+= "and no legs (<b>so you can't dodge attacks</b>).";
262 descr
+= "You are wearing " + ((clothing
.length
> 0) ? "a " + getClothingDescr
() : "nothing" ) + ".";;
266 return baseType
.gender
.doReplace
(descr
);
269 override public function getTypeName
():String
271 return baseType
.getTypeName
();
274 override public function levelUp
(firstTime
:Boolean = false):void
276 baseType
.levelUp
(firstTime
);
279 public function setBaseType
(base
:Creature
):void
282 baseType
.abilities
["instawin"] = new Instawin
();
286 override public function hasEnchantment(name:String):Boolean {
287 return baseType.hasEnchantment(name);
290 override public function addEnchantment(ench:Enchantment):String
292 return baseType.addEnchantment(ench);
294 override public function notifyEnchantments(e:*):Boolean
296 return baseType.notifyEnchantments(e);
299 override public function get assholes
():Vector
.<Asshole
>
301 return baseType
._assholes
;
304 override public function set assholes
(balls
:Vector
.<Asshole
>):void
306 baseType
._assholes
= balls
;
310 override public function get breasts
():Vector
.<Breast
>
312 return baseType
._breasts
;
315 override public function set breasts
(balls
:Vector
.<Breast
>):void
317 baseType
._breasts
= balls
;
321 override public function get eyes
():Vector
.<Eye
>
323 return baseType
._eyes
;
326 override public function set eyes
(balls
:Vector
.<Eye
>):void
328 baseType
._eyes
= balls
;
332 override public function get vaginas
():Vector
.<Vagina
>
334 return baseType
._vaginas
;
337 override public function set vaginas
(balls
:Vector
.<Vagina
>):void
339 baseType
._vaginas
= balls
;
343 override public function get arms
():Vector
.<Arm
>
345 return baseType
._arms
;
348 override public function set arms
(arr
:Vector
.<Arm
>):void
350 baseType
._arms
= arr
;
354 override public function get legs
():Vector
.<Leg
>
356 return baseType
._legs
;
359 override public function set legs
(arr
:Vector
.<Leg
>):void
361 baseType
._legs
= arr
;
365 override public function get wings
():Vector
.<Wing
>
367 return baseType
._wings
;
370 override public function set wings
(arr
:Vector
.<Wing
>):void
372 baseType
._wings
= arr
;
376 override public function get balls
():Vector
.<Testicle
>
378 return baseType
._balls
;
381 override public function set balls
(balls
:Vector
.<Testicle
>):void
383 baseType
._balls
= balls
;
387 override public function get dicks
():Vector
.<Penis
>
389 return baseType
._dicks
;
392 override public function set dicks
(balls
:Vector
.<Penis
>):void
394 baseType
._dicks
= balls
;
398 public override function get strength
():int
400 return baseType
.strength
;
403 public override function set strength
(value
:int):void
405 baseType
.strength
= value
;
408 public override function get mana
():int
410 return baseType
.mana
;
413 public override function set mana
(value
:int):void
415 baseType
.mana
= value
;
418 public override function get speed
():int
420 return baseType
.speed
;
423 public override function set speed
(value
:int):void
425 baseType
.speed
= value
;
428 public override function get intellect
():int
430 return baseType
.intellect
;
433 public override function set intellect
(value
:int):void
435 baseType
.intellect
= value
;
438 public override function get sensitivity
():int
440 return baseType
.sensitivity
;
443 public override function set sensitivity
(value
:int):void
445 baseType
.sensitivity
= value
;
448 public override function get abilities
():Object
450 return baseType
.abilities
;
453 public override function set abilities
(arr
:Object):void
455 baseType
.abilities
= arr
;
458 public override function get gender
():Gender
460 return baseType
.gender
;
463 public override function set gender
(arr
:Gender
):void
465 baseType
.gender
= arr
;
468 public override function get level
():int
470 return baseType
.level
;
473 public override function get HP
():int
478 public override function get maxHP
():int
480 return baseType
.maxHP
;
483 public override function get maxMana
():int
485 return baseType
.maxMana
;
488 public override function set HP
(value
:int):void
494 public override function get XP
():int
499 public override function get maxXP
():int
501 trace
("maxXP", baseType
.maxXP
);
502 return baseType
.maxXP
;
505 public override function set XP
(value
:int):void
511 override public function get gold
():int
513 return baseType
.gold
;
516 override public function set gold
(value
:int):void
518 baseType
.gold
= value
;