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
.isBald
())
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 hair
():Hair
{
300 return baseType
.hair
;
302 override public function set hair
(value
:Hair
):void {
303 baseType
.hair
= value
;
305 override public function get assholes
():Vector
.<Asshole
>
307 return baseType
._assholes
;
310 override public function set assholes
(balls
:Vector
.<Asshole
>):void
312 baseType
._assholes
= balls
;
316 override public function get breasts
():Vector
.<Breast
>
318 return baseType
._breasts
;
321 override public function set breasts
(balls
:Vector
.<Breast
>):void
323 baseType
._breasts
= balls
;
327 override public function get eyes
():Vector
.<Eye
>
329 return baseType
._eyes
;
332 override public function set eyes
(balls
:Vector
.<Eye
>):void
334 baseType
._eyes
= balls
;
338 override public function get vaginas
():Vector
.<Vagina
>
340 return baseType
._vaginas
;
343 override public function set vaginas
(balls
:Vector
.<Vagina
>):void
345 baseType
._vaginas
= balls
;
349 override public function get arms
():Vector
.<Arm
>
351 return baseType
._arms
;
354 override public function set arms
(arr
:Vector
.<Arm
>):void
356 baseType
._arms
= arr
;
360 override public function get legs
():Vector
.<Leg
>
362 return baseType
._legs
;
365 override public function set legs
(arr
:Vector
.<Leg
>):void
367 baseType
._legs
= arr
;
371 override public function get wings
():Vector
.<Wing
>
373 return baseType
._wings
;
376 override public function set wings
(arr
:Vector
.<Wing
>):void
378 baseType
._wings
= arr
;
382 override public function get balls
():Vector
.<Testicle
>
384 return baseType
._balls
;
387 override public function set balls
(balls
:Vector
.<Testicle
>):void
389 baseType
._balls
= balls
;
393 override public function get dicks
():Vector
.<Penis
>
395 return baseType
._dicks
;
398 override public function set dicks
(balls
:Vector
.<Penis
>):void
400 baseType
._dicks
= balls
;
404 public override function get strength
():int
406 return baseType
.strength
;
409 public override function set strength
(value
:int):void
411 baseType
.strength
= value
;
414 public override function get mana
():int
416 return baseType
.mana
;
419 public override function set mana
(value
:int):void
421 baseType
.mana
= value
;
424 public override function get speed
():int
426 return baseType
.speed
;
429 public override function set speed
(value
:int):void
431 baseType
.speed
= value
;
434 public override function get intellect
():int
436 return baseType
.intellect
;
439 public override function set intellect
(value
:int):void
441 baseType
.intellect
= value
;
444 public override function get sensitivity
():int
446 return baseType
.sensitivity
;
449 public override function set sensitivity
(value
:int):void
451 baseType
.sensitivity
= value
;
454 public override function get abilities
():Object
456 return baseType
.abilities
;
459 public override function set abilities
(arr
:Object):void
461 baseType
.abilities
= arr
;
464 public override function get gender
():Gender
466 return baseType
.gender
;
469 public override function set gender
(arr
:Gender
):void
471 baseType
.gender
= arr
;
474 public override function get level
():int
476 return baseType
.level
;
479 public override function get HP
():int
484 public override function get maxHP
():int
486 return baseType
.maxHP
;
489 public override function get maxMana
():int
491 return baseType
.maxMana
;
494 public override function set HP
(value
:int):void
500 public override function get XP
():int
505 public override function get maxXP
():int
507 trace
("maxXP", baseType
.maxXP
);
508 return baseType
.maxXP
;
511 public override function set XP
(value
:int):void
517 override public function get gold
():int
519 return baseType
.gold
;
522 override public function set gold
(value
:int):void
524 baseType
.gold
= value
;