Fix hair, dick around with new game screen.
[18plus-7leafadventure.git] / src / org / sevenchan / dongs / bodyparts / Arm.as
blobf799aa353b8afb028bcd52ada5c38eacc0a83a2d
1 package org.sevenchan.dongs.bodyparts
3 import org.sevenchan.dongs.clothing.Clothing;
4 import org.sevenchan.dongs.Creature;
5 import org.sevenchan.dongs.creature.Player;
6 import org.sevenchan.dongs.enchantment.*;
7 import flash.net.registerClassAlias;
8 import org.sevenchan.dongs.screens.InfoScreen;
9 import org.sevenchan.dongs.weapons.IWeapon;
11 /**
12 * ...
13 * @author Harbinger
15 public class Arm implements IBodyPart
17 registerClassAlias("P_Arm", Arm);
19 private var _name:String;
20 public var _location:String = "";
22 public function get location():String
24 return _location;
27 public function Arm(value:Number = 0, name:String = "human", atkEnch:Enchantment = null, defEnch:Enchantment = null)
29 _value = value;
30 _name = name;
33 private var _value:Number;
35 public function get value():Number
37 return _value;
40 public function get name():String
42 return _name;
45 public function get category():String
47 return "arms";
50 public function get sellDesc():String
52 return getShortDescr(true);
55 public function getDescr(num:Number, host:Creature):String
57 var o:String = num + " " + Utils.pluralize(num, getShortDescr(true));
58 if (location.length > 0)
59 o += " growing out of %POS% " + location;
60 return o;
63 public function getShortDescr(withModifier:Boolean = false):String
65 var t:String = "arm";
66 if (withModifier)
67 t = name + " " + t;
68 return t;
71 public function onFailedAttack(from:Creature, to:Creature):void
73 if (from is Player)
74 InfoScreen.push(to.gender.doReplace("<p>You attempt to strike the " + to.getTypeName() + " with your fist, but %SUB% moves too quickly and evades the attack!</p>"));
75 else
76 InfoScreen.push(from.gender.doReplace("<p>%VSUB% attempts to strike you with %POS% fist, but you move too quickly and evade the attack!</p>"));
79 public function onGoodAttack(from:Creature, to:Creature):void
81 var dmg:Number = from.damageAgainst(to, weapon);
82 if (from is Player)
83 InfoScreen.push(to.gender.doReplace("<p>You smash the " + to.getTypeName() + " in the face with your fist, dealing " + dmg + " damage!</p>"));
84 else
85 InfoScreen.push(from.gender.doReplace("<p>%CSUB% punches you with %POS% fist, dealing " + dmg + " damage!</p>"));
86 //trace("["+getDescr(1,from)+"] BEFORE: "+to.HP);
87 to.HP -= dmg;
88 //trace("["+getDescr(1,from)+"] AFTER: "+to.HP);
91 public function isConcealedBy(host:Creature, clothing:Vector.<Clothing>):Boolean
93 return clothing.some(function(c_:Object, index:int, vector:Vector.<Clothing>):Boolean
95 var c:Clothing = Clothing(c_);
96 if (c != null)
97 return (c.type.obscures.indexOf(category) > -1);
98 else
99 return false;
103 private var _weapon:IWeapon = null;
105 public function get weapon():IWeapon
107 return _weapon;
110 public function tryEquip(weap:IWeapon):Boolean
112 if (weap.canEquipOn(this))
114 _weapon = weap;
115 return true;
117 return false;