Fix hair, dick around with new game screen.
[18plus-7leafadventure.git] / src / org / sevenchan / dongs / bodyparts / Leg.as
blob46d7070e48546d5de8b07991fdd3059d168539a3
1 package org.sevenchan.dongs.bodyparts
3 import org.sevenchan.dongs.*;
4 import org.sevenchan.dongs.creature.*;
5 import org.sevenchan.dongs.screens.InfoScreen;
6 import flash.net.registerClassAlias;
7 import org.sevenchan.dongs.weapons.IWeapon;
8 import org.sevenchan.dongs.clothing.Clothing;
10 /**
11 * ...
12 * @author Harbinger
14 public class Leg implements IBodyPart
16 registerClassAlias("P_Leg", Leg);
18 private var _name:String;
19 private var _location:String = "";
20 private var _value:Number;
22 public function Leg(value:Number = 0, name:String = "")
24 _value = value;
25 _name = name;
28 public function get value():Number
30 return _value;
33 public function get category():String
35 return "legs";
38 public function get name():String
40 return _name;
43 public function get location():String
45 return _location;
48 public function getDescr(num:Number, host:Creature):String
50 var o:String = num + " " + name + " leg" + ((num > 1) ? "s" : "");
51 if (_location.length > 0)
52 o += " growing out of %POS% " + location;
53 return o;
56 public function get sellDesc():String
58 return getShortDescr(true);
61 public function onFailedAttack(from:Creature, to:Creature):void
63 if (from is Player)
64 InfoScreen.push(to.gender.doReplace("<p>You attempt to kick the " + to.getTypeName() + ", but %SUB% moves too quickly and evades the attack!</p>"));
65 else
66 InfoScreen.push(from.gender.doReplace("<p>%CSUB% attempts to kick you, but you move too quickly and evade the attack!</p>"));
69 public function onGoodAttack(from:Creature, to:Creature):void
71 if (weapon != null)
72 return onGoodAttack(from, to);
73 var dmg:Number = from.damageAgainst(to,weapon);
74 var txt:String = "";
75 if (from is Player)
77 txt = MathUtils.getRandomArrayEntry(["You deliver a powerful round kick to the " + to.getTypeName(), "You kick the " + to.getTypeName(), "The " + to.getTypeName() + " gets a foot to the face",]);
78 InfoScreen.push(to.gender.doReplace("<p>" + txt + ", dealing " + dmg + " damage!</p>"));
80 else
82 txt = MathUtils.getRandomArrayEntry(["%CSUB% kicks you", "You discover how " + from.getTypeName() + " feet taste", "One of %POS%'s kicks find your face",]);
83 InfoScreen.push(from.gender.doReplace("<p>" + txt + ", causing " + dmg + " damage!</p>"));
85 to.HP -= dmg;
88 public function getShortDescr(withModifier:Boolean = false):String
90 var t:String = "leg";
91 if (withModifier)
92 t = name + " " + t;
93 return t;
96 private var _weapon:IWeapon = null;
97 public function get weapon():IWeapon { return _weapon; }
98 public function tryEquip(weap:IWeapon):Boolean
100 if (weap.canEquipOn(this)){
101 _weapon = weap;
102 return true;
104 return false;
107 public function isConcealedBy(host:Creature, clothing:Vector.<Clothing>):Boolean
109 return clothing.some(function(c_:Object, index:int, vector:Vector.<Clothing>):Boolean
111 var c:Clothing = Clothing(c_);
112 if (c != null)
113 return (c.type.obscures.indexOf(category) > -1);
114 else
115 return false;