Result execute(Context & context) { float intensity = context.getFloat(); float duration = context.getFloat(); float period = context.getFloat(); DebugScript(' ' << intensity << ' ' << duration << ' ' << period); AddQuakeFX(intensity, duration, period, true); return Success; }
float ARX_DAMAGES_DamagePlayer(float dmg, DamageType type, EntityHandle source) { if (player.playerflags & PLAYERFLAGS_INVULNERABILITY) return 0; float damagesdone = 0.f; if(player.lifePool.current == 0.f) return damagesdone; if(dmg > player.lifePool.current) damagesdone = dmg; else damagesdone = player.lifePool.current; entities.player()->dmg_sum += dmg; if(float(arxtime) > entities.player()->ouch_time + 500) { Entity * oes = EVENT_SENDER; if(ValidIONum(source)) EVENT_SENDER = entities[source]; else EVENT_SENDER = NULL; entities.player()->ouch_time = (unsigned long)(arxtime); char tex[32]; sprintf(tex, "%5.2f", entities.player()->dmg_sum); SendIOScriptEvent( entities.player(), SM_OUCH, tex ); EVENT_SENDER = oes; float power = entities.player()->dmg_sum / player.lifePool.max * 220.f; AddQuakeFX(power * 3.5f, 500 + power * 3, rnd() * 100.f + power + 200, 0); entities.player()->dmg_sum = 0.f; } if(dmg > 0.f) { if(ValidIONum(source)) { Entity * pio = NULL; if(entities[source]->ioflags & IO_NPC) { pio = entities[source]->_npcdata->weapon; if(pio && (pio->poisonous == 0 || pio->poisonous_count == 0)) pio = NULL; } if(!pio) pio = entities[source]; if(pio && pio->poisonous && pio->poisonous_count != 0) { if(rnd() * 100.f > player.m_misc.resistPoison) { player.poison += pio->poisonous; } if(pio->poisonous_count != -1) pio->poisonous_count--; } } long alive; if(player.lifePool.current > 0) alive = 1; else alive = 0; if(!BLOCK_PLAYER_CONTROLS) player.lifePool.current -= dmg; if(player.lifePool.current <= 0.f) { player.lifePool.current = 0.f; if(alive) { //REFUSE_GAME_RETURN = 1; ARX_PLAYER_BecomesDead(); if((type & DAMAGE_TYPE_FIRE) || (type & DAMAGE_TYPE_FAKEFIRE)) { ARX_SOUND_PlayInterface(SND_PLAYER_DEATH_BY_FIRE); } SendIOScriptEvent(entities.player(), SM_DIE); for(size_t i = 1; i < entities.size(); i++) { const EntityHandle handle = EntityHandle(i); Entity * ioo = entities[handle]; if(ioo && (ioo->ioflags & IO_NPC)) { if(ioo->targetinfo == TARGET_PLAYER) { EVENT_SENDER = entities.player(); std::string killer; if(source == PlayerEntityHandle) { killer = "player"; } else if(source <= EntityHandle::Invalid) { killer = "none"; } else if(ValidIONum(source)) { killer = entities[source]->idString(); } SendIOScriptEvent(entities[handle], SM_NULL, killer, "target_death"); } } } } } if(player.lifePool.max <= 0.f) return damagesdone; float t = dmg / player.lifePool.max; if(Blood_Pos == 0.f) { Blood_Pos = 0.000001f; Blood_Duration = 100 + (t * 200.f); } else { long temp = t * 800.f; Blood_Duration += temp; } } // revient les barres ResetPlayerInterface(); return damagesdone; }