void process_disease(struct Thing *creatng) { SYNCDBG(18,"Starting"); //_DK_process_disease(thing); struct CreatureControl *cctrl; cctrl = creature_control_get_from_thing(creatng); if (!creature_affected_by_spell(creatng, SplK_Disease)) { return; } if (ACTION_RANDOM(100) < game.disease_transfer_percentage) { SubtlCodedCoords stl_num; long n; stl_num = get_subtile_number(creatng->mappos.x.stl.num,creatng->mappos.y.stl.num); for (n=0; n < AROUND_MAP_LENGTH; n++) { struct Thing *thing; struct Map *mapblk; unsigned long k; long i; mapblk = get_map_block_at_pos(stl_num+around_map[n]); k = 0; i = get_mapwho_thing_index(mapblk); while (i != 0) { thing = thing_get(i); if (thing_is_invalid(thing)) { WARNLOG("Jump out of things array"); break; } i = thing->next_on_mapblk; // Per thing code if (thing_is_creature(thing) && ((get_creature_model_flags(thing) & CMF_IsSpecDigger) == 0) && (thing->owner != cctrl->disease_caster_plyridx) && !creature_affected_by_spell(thing, SplK_Disease)) { struct CreatureControl *tngcctrl; tngcctrl = creature_control_get_from_thing(thing); apply_spell_effect_to_thing(thing, SplK_Disease, cctrl->explevel); tngcctrl->disease_caster_plyridx = cctrl->disease_caster_plyridx; } // Per thing code ends k++; if (k > THINGS_COUNT) { ERRORLOG("Infinite loop detected when sweeping things list"); erstat_inc(ESE_InfChainTngPerMapWho); break_mapwho_infinite_chain(mapblk); break; } } } } if (((game.play_gameturn - cctrl->disease_start_turn) % game.disease_lose_health_time) == 0) { apply_damage_to_thing_and_display_health(creatng, game.disease_lose_percentage_health * cctrl->max_health / 100, DmgT_Biological, cctrl->disease_caster_plyridx); } }
void update_god_lightning_ball(struct Thing *thing) { struct CreatureControl *cctrl; struct Thing *target; struct ShotConfigStats *shotst; long i; // _DK_update_god_lightning_ball(thing); if (thing->health <= 0) { lightning_modify_palette(thing); return; } i = (game.play_gameturn - thing->creation_turn) % 16; switch (i) { case 0: god_lightning_choose_next_creature(thing); break; case 1: target = thing_get(thing->shot.target_idx); if (thing_is_invalid(target)) break; draw_lightning(&thing->mappos,&target->mappos, 96, 60); break; case 2: target = thing_get(thing->shot.target_idx); if (thing_is_invalid(target)) break; shotst = get_shot_model_stats(24); apply_damage_to_thing_and_display_health(target, shotst->old->damage, shotst->damage_type, thing->owner); if (target->health < 0) { cctrl = creature_control_get_from_thing(target); cctrl->shot_model = ShM_GodLightBall; kill_creature(target, INVALID_THING, thing->owner, CrDed_DiedInBattle); } thing->shot.target_idx = 0; break; } }