void monster::process_effects() { for( auto effect_it = effects.begin(); effect_it != effects.end(); ++effect_it ) { std::string id = effect_it->second.get_id(); if (id == "nasty_poisoned") { mod_speed_bonus( -rng(3, 5) ); apply_damage( nullptr, bp_torso, rng( 3, 6 ) ); } if (id == "poisoned") { mod_speed_bonus( -rng(0, 3) ); apply_damage( nullptr, bp_torso, rng( 1, 3 ) ); // MATERIALS-TODO: use fire resistance } else if (id == "onfire") { if (made_of("flesh") || made_of("iflesh")) apply_damage( nullptr, bp_torso, rng( 3, 8 ) ); if (made_of("veggy")) apply_damage( nullptr, bp_torso, rng( 10, 20 ) ); if (made_of("paper") || made_of("powder") || made_of("wood") || made_of("cotton") || made_of("wool")) apply_damage( nullptr, bp_torso, rng( 15, 40 ) ); } } Creature::process_effects(); }
void Character::mod_stat( const std::string &stat, int modifier ) { if( stat == "str" ) { mod_str_bonus( modifier ); } else if( stat == "dex" ) { mod_dex_bonus( modifier ); } else if( stat == "per" ) { mod_per_bonus( modifier ); } else if( stat == "int" ) { mod_int_bonus( modifier ); } else if( stat == "healthy" ) { mod_healthy( modifier ); } else if( stat == "hunger" ) { mod_hunger( modifier ); } else if( stat == "speed" ) { mod_speed_bonus( modifier ); } else if( stat == "dodge" ) { mod_dodge_bonus( modifier ); } else if( stat == "block" ) { mod_block_bonus( modifier ); } else if( stat == "hit" ) { mod_hit_bonus( modifier ); } else if( stat == "bash" ) { mod_bash_bonus( modifier ); } else if( stat == "cut" ) { mod_cut_bonus( modifier ); } else if( stat == "pain" ) { mod_pain( modifier ); } else if( stat == "moves" ) { mod_moves( modifier ); } else { Creature::mod_stat( stat, modifier ); } }
void Creature::mod_stat( std::string stat, int modifier ) { if( stat == "str" ) { mod_str_bonus( modifier ); } else if( stat == "dex" ) { mod_dex_bonus( modifier ); } else if( stat == "per" ) { mod_per_bonus( modifier ); } else if( stat == "int" ) { mod_int_bonus( modifier ); } else if( stat == "speed" ) { mod_speed_bonus( modifier ); } else if( stat == "dodge" ) { mod_dodge_bonus( modifier ); } else if( stat == "block" ) { mod_block_bonus( modifier ); } else if( stat == "hit" ) { mod_hit_bonus( modifier ); } else if( stat == "bash" ) { mod_bash_bonus( modifier ); } else if( stat == "cut" ) { mod_cut_bonus( modifier ); } else if( stat == "pain" ) { mod_pain( modifier ); } else if( stat == "moves" ) { mod_moves( modifier ); } else { add_msg( "Tried to modify a nonexistent stat %s.", stat.c_str() ); } }
void monster::process_effects() { for( auto effect_it = effects.begin(); effect_it != effects.end(); ++effect_it ) { std::string id = effect_it->second.get_id(); if (id == "nasty_poisoned") { mod_speed_bonus( -rng(3, 5) ); apply_damage( nullptr, bp_torso, rng( 3, 6 ) ); } if (id == "poisoned") { mod_speed_bonus( -rng(0, 3) ); apply_damage( nullptr, bp_torso, rng( 1, 3 ) ); // MATERIALS-TODO: use fire resistance } else if (id == "onfire") { if (made_of("flesh") || made_of("iflesh")) apply_damage( nullptr, bp_torso, rng( 3, 8 ) ); if (made_of("veggy")) apply_damage( nullptr, bp_torso, rng( 10, 20 ) ); if (made_of("paper") || made_of("powder") || made_of("wood") || made_of("cotton") || made_of("wool")) apply_damage( nullptr, bp_torso, rng( 15, 40 ) ); } } //If this monster has the ability to heal in combat, do it now. if( has_flag( MF_REGENERATES_50 ) ) { if( hp < type->hp ) { if( one_in( 2 ) && g->u.sees( this ) ) { add_msg( m_warning, _( "The %s is visibly regenerating!" ), name().c_str() ); } hp += 50; if( hp > type->hp ) { hp = type->hp; } } } if( has_flag( MF_REGENERATES_10 ) ) { if( hp < type->hp ) { if( one_in( 2 ) && g->u.sees( this ) ) { add_msg( m_warning, _( "The %s seems a little healthier." ), name().c_str() ); } hp += 10; if( hp > type->hp ) { hp = type->hp; } } } //Monster will regen morale and aggression if it is on max HP //It regens more morale and aggression if is currently fleeing. if( has_flag( MF_REGENMORALE ) && hp >= type->hp ) { if( is_fleeing( g->u ) ) { morale = type->morale; anger = type->agro; } if( morale <= type->morale ) { morale += 1; } if( anger <= type->agro ) { anger += 1; } if( morale < 0 ) { morale += 5; } if( anger < 0 ) { anger += 5; } } // If this critter dies in sunlight, check & assess damage. if( has_flag( MF_SUNDEATH ) && g->is_in_sunlight( posx(), posy() ) ) { if( g->u.sees( this ) ) { add_msg( m_good, _( "The %s burns horribly in the sunlight!" ), name().c_str() ); } hp -= 100; if( hp < 0 ) { hp = 0; } } Creature::process_effects(); }
void monster::process_effects() { // Monster only effects int mod = 1; for( auto &elem : effects ) { for( auto &_effect_it : elem.second ) { auto &it = _effect_it.second; // Monsters don't get trait-based reduction, but they do get effect based reduction bool reduced = has_effect(it.get_resist_effect()); mod_speed_bonus(it.get_mod("SPEED", reduced)); int val = it.get_mod("HURT", reduced); if (val > 0) { if(it.activated(calendar::turn, "HURT", val, reduced, mod)) { apply_damage(nullptr, bp_torso, val); } } std::string id = _effect_it.second.get_id(); // MATERIALS-TODO: use fire resistance if (id == "onfire") { if (made_of("flesh") || made_of("iflesh")) apply_damage( nullptr, bp_torso, rng( 3, 8 ) ); if (made_of("veggy")) apply_damage( nullptr, bp_torso, rng( 10, 20 ) ); if (made_of("paper") || made_of("powder") || made_of("wood") || made_of("cotton") || made_of("wool")) apply_damage( nullptr, bp_torso, rng( 15, 40 ) ); } } } //If this monster has the ability to heal in combat, do it now. if( has_flag( MF_REGENERATES_50 ) ) { if( hp < type->hp ) { if( one_in( 2 ) && g->u.sees( *this ) ) { add_msg( m_warning, _( "The %s is visibly regenerating!" ), name().c_str() ); } hp += 50; if( hp > type->hp ) { hp = type->hp; } } } if( has_flag( MF_REGENERATES_10 ) ) { if( hp < type->hp ) { if( one_in( 2 ) && g->u.sees( *this ) ) { add_msg( m_warning, _( "The %s seems a little healthier." ), name().c_str() ); } hp += 10; if( hp > type->hp ) { hp = type->hp; } } } //Monster will regen morale and aggression if it is on max HP //It regens more morale and aggression if is currently fleeing. if( has_flag( MF_REGENMORALE ) && hp >= type->hp ) { if( is_fleeing( g->u ) ) { morale = type->morale; anger = type->agro; } if( morale <= type->morale ) { morale += 1; } if( anger <= type->agro ) { anger += 1; } if( morale < 0 ) { morale += 5; } if( anger < 0 ) { anger += 5; } } // If this critter dies in sunlight, check & assess damage. if( has_flag( MF_SUNDEATH ) && g->is_in_sunlight( posx(), posy() ) ) { if( g->u.sees( *this ) ) { add_msg( m_good, _( "The %s burns horribly in the sunlight!" ), name().c_str() ); } apply_damage( nullptr, bp_torso, 100 ); if( hp < 0 ) { hp = 0; } } Creature::process_effects(); }