Esempio n. 1
0
bool check_word_kill(CHAR_DATA *ch, CHAR_DATA *victim, int type, int spell)
{
    if( (!IS_NPC(victim) && IS_IMMORTAL(victim)) || 100*victim->hit/UMAX(get_max_hp(victim), 1) > 24 )
        return TRUE;

    return FALSE;
}
Esempio n. 2
0
bool check_word_blind(CHAR_DATA *ch, CHAR_DATA *victim, int type, int spell)
{
    if( IS_AFFECTED(victim, AFF_BLIND) ||  100*victim->hit/UMAX(get_max_hp(victim), 1) > 39 )
        return TRUE;

    return FALSE;
}
Esempio n. 3
0
bool check_word_stun(CHAR_DATA *ch, CHAR_DATA *victim, int type, int spell)
{
    if( 100*victim->hit/UMAX(get_max_hp(victim), 1) > 39 )
        return TRUE;

    return FALSE;
}
Esempio n. 4
0
 // Post battle update
 inline void set_info(int str)
 {
     info_str.setString(std::to_string(str));
     health_bar_bg.setSize(sf::Vector2f(get_max_hp()/scale, 10));
     health_bar_bg.setOutlineColor(sf::Color(125,125,125));
     health_bar_bg.setOutlineThickness(1);
     health_bar_current.setSize(sf::Vector2f(str/scale, 10));
     health_bar_current.setFillColor(get_life_color(str));
 }
Esempio n. 5
0
void Building::draw_hp(){
	if(get_hp()<get_max_hp()){
		Display::CubeLight* building_light=new Display::CubeLight();
		building_light->color=glm::vec3(3,0,0);


		building_light->cube_size=glm::vec3(
				Map::CUBE_SIZE*1.0*get_cube_large_size().x,
				Map::CUBE_SIZE*1.0*get_cube_large_size().y*
				((get_max_hp()-get_hp())/(double)get_max_hp()),

				Map::CUBE_SIZE*1.0*get_cube_large_size().z);

		building_light->pos=glm::vec3(
				  x*Map::CUBE_SIZE+0.49*building_light->cube_size.x,
				  y*Map::CUBE_SIZE+0.49*building_light->cube_size.y,
				  z*Map::CUBE_SIZE+0.49*building_light->cube_size.z);
		Display::Draw::get_cur_object()->lightControl->push_temp_light(building_light);
	}
}
Esempio n. 6
0
 // Set some information about the object
 inline void set_info(int str, sf::Font *font, int size)
 {
     info_str.setString(std::to_string(str));
     info_str.setFont(*font);
     info_str.setCharacterSize(size);
     info_str.setColor(sf::Color::Black);
     health_bar_bg.setSize(sf::Vector2f(get_max_hp()/scale, 10));
     health_bar_bg.setOutlineColor(sf::Color(125,125,125));
     health_bar_bg.setOutlineThickness(1);
     health_bar_current.setSize(sf::Vector2f(str/scale, 10));
     health_bar_current.setFillColor(get_life_color(str));
 }
Esempio n. 7
0
    inline sf::Color get_life_color(int str)
    {
        int red, green;
        float life_fraction = str/(float)get_max_hp();
        if (life_fraction > 0.5) {

            red = int(2*(255-255*life_fraction));
            green = 255;
        }
        else {
            red = 255;
            green = int(255*life_fraction*2);
        }
        return sf::Color(red,green,0);
    }
Esempio n. 8
0
/* nie uzywane */
int need_help(CHAR_DATA *ch, CHAR_DATA *gch)
{
    int hp_percent, ret;

    hp_percent = (100*gch->hit)/get_max_hp(gch);

    if( hp_percent < 30 )
	ret = 5;
    else if( hp_percent < 45 )
	ret = 4;
    else if( hp_percent < 60 )
	ret = 2;
    else if( hp_percent < 75)
	ret = 1;
    else
	ret = 0;

    if(!can_move(gch) && ret > 0)
	ret++;

    return ret;
}
Esempio n. 9
0
/* czy ten mob sie nadaje do tankowania*/
int check_tank(CHAR_DATA *ch)
{
int average_hp, hp_percent;

    average_hp = get_max_hp(ch)/UMAX(1, ch->level);
    hp_percent = (100*ch->hit)/UMAX(1, get_max_hp(ch));

    /* jesli ma ponizej 30%hp */
    if( hp_percent < 30 )
	return 0;

    if(!IS_NPC(ch))
    {
        if( average_hp < 15)
	return 1;

	switch(average_hp)
	{
	    case 15:
	    case 16:
	    case 17:
		    return 2;
	    case 18:
    	    case 19:
	    case 20:
		    return 3;
	    case 21:
	    case 22:
	    case 23:
		    return 4;
	    default:
		    return 5;
	}
	return 0;
    }

    if( average_hp < 20)
	return 1;

    switch(average_hp)
    {
	case 20:
	case 21:
	case 22:
	case 23:
	case 24:
		    return 2;
	case 25:
	case 26:
	case 27:
	case 28:
	case 29:
		    return 3;
	case 30:
	case 31:
	case 32:
	case 33:
	case 34:
	case 35:
		    return 4;
	default:
		    return 5;
    }

    return 0;
}
Esempio n. 10
0
bool spec_hunter( CHAR_DATA *ch )
{
    CHAR_DATA * vch, *victim = NULL;
    int dam, chance;

    if ( !IS_AWAKE( ch ) || IS_AFFECTED( ch, AFF_CALM ) || ch->in_room == NULL
         || IS_AFFECTED( ch, AFF_CHARM ) || ch->fighting != NULL )
        return FALSE;

	if ( (ch->hit*100)/get_max_hp( ch ) < 50 )
		return FALSE;

    for ( vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room )
    {
        if ( !IS_NPC( vch ) || ch == vch )
            continue;

		if( is_safe( ch, vch, TRUE ) )
			continue;

		if( vch->fighting )
			continue;

		if( !can_see( ch, vch ) )
			continue;

        if ( ch->level - 2 < vch->level )
        	continue;

        if ( IS_AFFECTED( vch, AFF_CHARM ) || vch->master )
        	continue;

        if ( IS_SET( race_table[ GET_RACE( vch ) ].type, ANIMAL ) )
        {
        	victim = vch;
        	break;
        }
        continue;
    }

    if ( victim == NULL )
        return FALSE;

	chance = 65;
	chance += ch->level*2;
	chance -= victim->level*2;
	chance += get_curr_stat_deprecated(ch,STAT_DEX)-10;
	chance -= get_curr_stat_deprecated(victim,STAT_DEX)-10;

	if( victim->size == SIZE_TINY )
		chance /= 4;
	else if( victim->size == SIZE_SMALL )
		chance /= 2;
	else if( victim->size == SIZE_LARGE )
		chance += chance/2;
	else if( victim->size == SIZE_HUGE )
		chance *= 2;
	else if( victim->size == SIZE_GIANT )
		chance *= 4;

	if( number_percent() > chance )
	{
		act( "$n wychyla siê nieco z ukrycia, wymierza ze swojego ³uku w $C, po czym strzela. Strza³a jednak przelatuje kilka centymetrów obok celu.", ch, NULL, victim, TO_ALL );
		multi_hit( victim, ch, TYPE_UNDEFINED );
        return TRUE;
	}

	dam = ch->level * 7;
	dam += (get_curr_stat_deprecated(ch, STAT_DEX)-10)*3;
	dam += (get_curr_stat_deprecated(ch, STAT_STR)-10)*3;
	dam += (get_curr_stat_deprecated(ch, STAT_LUC)-10);
	dam -= (get_curr_stat_deprecated(victim, STAT_CON)-10)*5;
	dam -= (get_curr_stat_deprecated(victim, STAT_LUC)-10);

	check_increase_wounds( victim, DAM_PIERCE, &dam );
	dam = check_resist( victim, DAM_PIERCE, dam );

	if( victim->hit - dam > -10 )
	{
	        bug("FIXME: uwzglêdnienie deflect wounds w sposób nie-bugogenny",0);
		if( victim->sex == SEX_FEMALE )
	    	act( "$n wychyla siê nieco z ukrycia, wymierza ze swojego ³uku w $C, po czym strzela trafiaj±c j± w tu³ów. Strza³a przelatuje na wylot, a ze zranionego korpusu $Z bucha czerwona posoka.", ch, NULL, victim, TO_ALL );
	    else
	    	act( "$n wychyla siê nieco z ukrycia, wymierza ze swojego ³uku w $C, po czym strzela trafiaj±c go w tu³ów. Strza³a przelatuje na wylot, a ze zranionego korpusu $Z bucha czerwona posoka.", ch, NULL, victim, TO_ALL );
	}
	else
	{
		if( victim->sex == SEX_FEMALE )
	    	act( "$n wychyla siê nieco z ukrycia, wymierza ze swojego ³uku w $C, po czym strzela trafiaj±c j± prosto w serce. Strza³a przelatuje na wylot, a z rozerwanych têtnic $Z bucha strumieniami czerwona posoka. $N chwieje siê przez chwilê po czym wywraca na ziemiê i nieruchomieje.", ch, NULL, victim, TO_ALL );
	    else
	    	act( "$n wychyla siê nieco z ukrycia, wymierza ze swojego ³uku w $C, po czym strzela trafiaj±c go prosto w serce. Strza³a przelatuje na wylot, a z rozerwanych têtnic $Z bucha strumieniami czerwona posoka. $N chwieje siê przez chwilê po czym wywraca na ziemiê i nieruchomieje.", ch, NULL, victim, TO_ALL );
	}

	raw_damage( ch, victim, UMAX( 30, dam ) );
	multi_hit( victim, ch, TYPE_UNDEFINED );

    return TRUE;
}