226 {
228 {
230 {
232 }
233
235
237 {
238 if (victim)
239 {
241 {
243 }
245 {
247 }
248 else if (victim.IsInherited(
ItemBase))
249 {
251 float damage_coef = 1;
252
253 if (victim_item.HasQuantity() && victim_item.GetQuantityMax() != 0 && victim_item.GetQuantity() > 0)
254 {
255 damage_coef = victim_item.GetQuantityMax() / victim_item.GetQuantity();
256 }
257
258 if (damage_coef > 0)
259 {
260 int item_size_x = 1;
261 int item_size_y = 1;
262 g_Game.GetInventoryItemSize(victim_item, item_size_x, item_size_y);
263
264 float add_damage = 300 * damage_coef /
Math.
Clamp(item_size_x * item_size_y, 1,
int.
MAX);
265 victim_item.DecreaseHealth("", "", add_damage);
266 }
267 }
268 }
269 }
270
272 }
273
275 }
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'.