217 {
219 {
221 {
223 }
224
226
228 {
229 if (victim)
230 {
232 {
234 }
236 {
238 }
239 else if (victim.IsInherited(
ItemBase))
240 {
242 float damage_coef = 1;
243
244 if (victim_item.HasQuantity() && victim_item.GetQuantityMax() != 0 && victim_item.GetQuantity() > 0)
245 {
246 damage_coef = victim_item.GetQuantityMax() / victim_item.GetQuantity();
247 }
248
249 if (damage_coef > 0)
250 {
251 int item_size_x = 1;
252 int item_size_y = 1;
253 g_Game.GetInventoryItemSize(victim_item, item_size_x, item_size_y);
254
255 float add_damage = 300 * damage_coef /
Math.
Clamp(item_size_x * item_size_y, 1,
int.
MAX);
256 victim_item.DecreaseHealth("", "", add_damage);
257 }
258 }
259 }
260 }
261
263 }
264
266 }
void Synch(EntityAI victim)
keeping "step" here for consistency only
void OnSteppedOn(EntityAI victim)
do not process rotations !
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.