bool Creature::is_immune( const std::string &type ) const { damage_type dt = dt_by_name( type ); if( dt != DT_NULL ) { return is_immune_damage( dt ); } return is_immune_effect( type ); }
damage_unit load_damage_unit( JsonObject &curr ) { damage_type dt = dt_by_name( curr.get_string( "damage_type" ) ); if( dt == DT_NULL ) { curr.throw_error( "Invalid damage type" ); } float amount = curr.get_float( "amount" ); int arpen = curr.get_int( "armor_penetration", 0 ); float armor_mul = curr.get_float( "armor_multiplier", 1.0f ); float damage_mul = curr.get_float( "damage_multiplier", 1.0f ); return damage_unit( dt, amount, arpen, armor_mul, damage_mul ); }