//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### //** ## ## ## ## ## ## ## ## ## ## ## ## ## ## //** ## ## ######## ## ## ## ## ## ## ## ### ## //** ### ## ## ### ## ## ## ## ## ## //** # ## ## # #### #### ## ## //** //** $Id: BasicArmorBonus.vc 2628 2007-08-12 06:09:47Z dj_jl $ //** //** Copyright (C) 1999-2006 Jānis Legzdiņš //** //** This program is free software; you can redistribute it and/or //** modify it under the terms of the GNU General Public License //** as published by the Free Software Foundation; either version 2 //** of the License, or (at your option) any later version. //** //** This program is distributed in the hope that it will be useful, //** but WITHOUT ANY WARRANTY; without even the implied warranty of //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //** GNU General Public License for more details. //** //************************************************************************** class BasicArmorBonus : Armor abstract; float SavePercent; int SaveAmount; int MaxSaveAmount; //========================================================================== // // Use // //========================================================================== bool Use(bool Pickup) { BasicArmor Armor = BasicArmor(EntityEx(Owner).FindInventory(BasicArmor)); if (!Armor) { Armor = Spawn(BasicArmor); Armor.Amount = 0; Armor.AttachToOwner(EntityEx(Owner)); } if (Armor.Amount >= MaxSaveAmount) { return false; } Armor.Amount += SaveAmount; if (Armor.Amount > MaxSaveAmount) { Armor.Amount = MaxSaveAmount; } if (!Armor.SavePercent) { Armor.SavePercent = SavePercent; } return true; } defaultproperties { MaxAmount = 0; bAutoActivate = true; bAlwaysPickup = true; SavePercent = 1.0 / 3.0; }