Пример #1
0
bool bolt_vs_hero(MagicBolt* bolt, Coord start)
{
    if (save(VS_MAGIC)) {
        msg("the %s whizzes by you", bolt->name().c_str());
        return false;
    }

    if (bolt->is_frost())
    {
        msg("You are frozen by a blast of frost.");
        if (game->hero().get_sleep_turns() < 20)
            game->hero().increase_sleep_turns(spread(7));
    }
    else {
        game->log("battle", "Flame 6d6 damage to player");
        if (!game->hero().decrease_hp(roll(6, 6), true)) {
            if (bolt->from_player)
                death('b');
            else
                death(game->level().monster_at(start)->m_type);
        }
        msg("you are hit by the %s", bolt->name().c_str());
    }

    return true;
}
Пример #2
0
void move_asteroids(double astr[][5], double shots[][5], int x1ship, int y1ship, int x2ship, int y2ship, double *x, double *y, double *speed, double *theta, int score[])
{
 int i;
 double j;
 asteroids(astr);
 for(i=0; i<32; i++){
	if(astr[i][3]!=0){
		astr[i][0]=astr[i][0]+astr[i][4]*cos(astr[i][2]); 	//iterates asteroid coordinates
		astr[i][1]=astr[i][1]-astr[i][4]*sin(astr[i][2]);
		for(j=0; j<2*PI; j=j+PI/50){
			//the line below checks whether ship has collided with an asteroid
			if((astr[i][0]+astr[i][3]*cos(j))<=x1ship && (astr[i][1]-astr[i][3]*sin(j))<=y1ship && (astr[i][0]+astr[i][3]*cos(j+PI))>=x2ship && (astr[i][1]-astr[i][3]*sin(j+PI))>=y2ship){
				*speed=0;
				*theta=0;	//resets theta and speed
				
				death(astr, shots, x, y, score);
			}
		}
		if(astr[i][0]>=740){
                        astr[i][0]=1;
                } else if(astr[i][0]<=-40){
                        astr[i][0]=699;
                } else if(astr[i][1]>=740){      //this keeps the ship from flying off the screen
                        astr[i][1]=1;
                } else if(astr[i][1]<=-40){
                        astr[i][1]=699;
                }
		gfx_color(0, 170, 255);
		gfx_circle(astr[i][0], astr[i][1], astr[i][3]);
	 	gfx_color(255, 255, 255);
	}
 }
}
Пример #3
0
//---------------------------------------------------
void Enemy::updateDodge(float time)
{

	m_HurtTime+=time;

	///旋转速度为每秒
	float ra=m_Rotate*time;
	m_pNode->rotate(Ogre::Vector3(0.0f,1.0f,0.0f), Ogre::Radian(ra),Ogre::Node::TS_WORLD);
	m_pNode->rotate(Ogre::Vector3(0.0f,0.0f,1.0f), Ogre::Radian(ra*0.5f),Ogre::Node::TS_WORLD);
	m_Rotate-=ra;


	////移动
	Ogre::Vector3 tr=m_Trans*0.3f*time;
	//m_pNode->translate(tr,Ogre::Node::TS_WORLD);
	m_Trans-=tr;

	float speed=1.0f;
	Ogre::Vector3 gravity(0,-3,0);
	gravity=gravity*speed*time*(m_HurtTime+1);
	gravity+=tr;
	m_pNode->translate(gravity,Ogre::Node::TS_WORLD);
	Ogre::Vector3 pos=m_pNode->_getDerivedPosition();


	///如果受作超过三秒就死亡
	if(m_HurtTime>=3.0f)
	{
		death();
	}


	return ;
}
Пример #4
0
fuse
suffocate(fuse_arg *arg)
{
    NOOP(arg);

    death(D_SUFFOCATION);
}
Пример #5
0
int
main(int argc, char*argv[]) {
    srand(time(NULL));

    if ((argc == 3)  && (argv[1][0] == 'd')) 
        death(argv[2]);
    else if (argc == 4) {
        float mean, stdev;
        sscanf(argv[2], "%f", &mean);
        sscanf(argv[3], "%f", &stdev);
        if (argv[1][0] == 'h') 
            gaussian(mean, stdev, DYSFUNCTION_HEIGHT);
        else if (argv[1][0] == 's') 
            gaussian(mean, stdev, DYSFUNCTION_WIDTH);
        else if (argv[1][0] == 'f') 
            gaussian(mean, stdev, DYSFUNCTION_FIRE);
        else {
            usage(argv[0]);
            return -1;
        }
    } else {
        usage(argv[0]);
        return -1;
    }

    return 0;
}//main()
Пример #6
0
void GameObj::damage(int amount, SoundManager &sm) {
	// Process incoming damage
	if(getArmor() > amount)
		return;				// armor negates all damage
	else amount -= getArmor();
	setHP(getHP() - amount);

	// SFX
	t_damaged.Calculate_Ellapsed_Time();
	if(t_damaged.TotalTime() >= TIMER_SOUND_DAMAGED) {
		SoundManager::Sounds soundID;
		switch(goSettings.getTypeID()) {
			case Settings::OBJ_ID_ARCHER: soundID = sm.SND_ARCHER_DAMAGED; break;
			case Settings::OBJ_ID_STONEWALL: soundID = sm.SND_STONEWALL_DAMAGED; break;
	//			case settings.OBJ_T_DOG: soundID = sm.SND_DOG_MELEE; break;
	//			case settings.OBJ_T_SPEARMAN: soundID = sm.SND_SPEARMAN_MELEE; break;
	//			case settings.OBJ_ID_ARCHER: soundID = sm.SND_ARCHER_MELEE; break;
			default: soundID = sm.SND_ARCHER_DAMAGED; break;
		}
		sm.playSound(soundSourceID, soundID, body->GetPosition());
		t_damaged.Reset(0.0);
	}

	// Special Behavior (defined in derived classes)
	damageSpecial(amount, sm);

	// Death sequence
	if(getHP() < 0) {
		death(sm);
	}
}
Пример #7
0
void Enemy::checkCollision(visualObj *star) {
	bool interact = isCollision(star);
	int healthColor = (105 + health * 50);

	///Enemy interection with star
	if (interact == true) {
		if (collisionTimer == 0)
			health--;
		if (health == 0 && respawnTimer == 0)	///If enemy has no health left
			respawnTimer = rand_int(5, 8) * 1000;	//Generates a random time for the enemy to respawn
		setColor(255, 0, 0);					//Enemy Collision [Damage taken, changes Red]
		collisionTimer = 400;					//Enemy turns red for certain period of time based on this
	}
	///Collision Timer counts down/makes enemy red
	if (collisionTimer > 0)
		collisionTimer--;							//Collision Timer count down
	else if (collisionTimer == 0)
		setColor(255, healthColor, healthColor);	//Changes enemy's color back after certain period of time
	///Respawn Timer
	if (respawnTimer > 0)
		respawnTimer--;	//Counts Down
	else if (respawnTimer == 0 && dead == true)
		respawn();		//Respawns after timer is up

	death();	//If Health = 0, Enemy is Dead
}
void CombatManager::HandleDeathEvent(MsgEntry *me,Client *client)
{
    psDeathEvent death(me);

    Debug1(LOG_COMBAT,death.deadActor->GetClientID(),"Combat Manager handling Death Event\n");

    // Stop any duels.
    if (death.deadActor->GetClient())
        death.deadActor->GetClient()->ClearAllDuelClients();

    // Stop actor moving.
    death.deadActor->StopMoving();

    // Send out the notification of death, which plays the anim, etc.
    psCombatEventMessage die(death.deadActor->GetClientID(),
                                psCombatEventMessage::COMBAT_DEATH,
                                death.killer ? death.killer->GetEID() : 0,
                                death.deadActor->GetEID(),
                                -1, // no target location
                                0,  // no dmg on a death
                                (unsigned int)-1,  // TODO: "killing blow" matrix of mob-types vs. weapon types
                                (unsigned int)-1 ); // Death anim on client side is handled by the death mode message

    die.Multicast(death.deadActor->GetMulticastClients(),0,MAX_COMBAT_EVENT_RANGE);
}
void EnemyTank::hit(const df::EventCollision *p_collision_event) {
    // If PlayerTank or PlayerCannonShot, create explosion and delete Tank
    if ((p_collision_event->getObject1()->getType() == "Tank") ||
            (p_collision_event->getObject2()->getType() == "Tank") ||
            (p_collision_event->getObject1()->getType() == "PlayerCannonShot") ||
            (p_collision_event->getObject2()->getType() == "PlayerCannonShot")) {

        // Create an explosion.
        SmallExplosion *p_explosion = new SmallExplosion(getPosition());

        // Play "explode" sound

        // Create "footsoldierdeath" event and send to interested Objects.
        df::WorldManager &world_manager = df::WorldManager::getInstance();
        EventFootSoldierDeath death(this);
        world_manager.onEvent(&death);

        //Send Points for deletion
        df::EventView ev(SCORE_STRING, TANK_POINTS, true);
        world_manager.onEvent(&ev);

        //Delete this object
        world_manager.markForDelete(this);
    }
}
Пример #10
0
void SpawnManager::HandleDeathEvent(MsgEntry *me,Client *notused)
{
    Debug1(LOG_SPAWN,0, "Spawn Manager handling Death Event\n");
    psDeathEvent death(me);

    death.deadActor->GetCharacterData()->KilledBy(death.killer ? death.killer->GetCharacterData() : NULL);
    if(death.killer)
    {
        death.killer->GetCharacterData()->Kills(death.deadActor->GetCharacterData());
    }

    // Respawning is handled with ResurrectEvents for players and by SpawnManager for NPCs
    if ( death.deadActor->GetClientID() )   // Handle Human Player dying
    {
        ServerStatus::player_deathcount++;
        psResurrectEvent *event = new psResurrectEvent(0,20000,death.deadActor);
        psserver->GetEventManager()->Push(event);
        Debug2(LOG_COMBAT, death.deadActor->GetClientID(), "Queued resurrect event for %s.\n",death.deadActor->GetName());
    }
    else  // Handle NPC dying
    {
        Debug1(LOG_NPC, 0,"Killing npc in spawnmanager.\n");
        // Remove NPC and queue for respawn
        KillNPC(death.deadActor, death.killer);
    }

    // Allow Actor to notify listeners of death
    death.deadActor->HandleDeath();
}
/*
 * unphase:
 *	Player can no longer walk through walls
 */
void
unphase(void)
{
    turn_off(player, CANINWALL);
    msg("Your dizzy feeling leaves you.");
    if (!step_ok(hero.y, hero.x, NOMONST, &player)) 
	death(D_PETRIFY);
}
Пример #12
0
/*
 * stomach:
 *	Digest the hero's food
 */
stomach()
{
    register int oldfood;
    //MDK_LOG("status: food_left=%d\n", food_left);
    if (food_left <= 0)
    {
	if (food_left-- < -STARVETIME)
	    death('s');
	/*
	 * the hero is fainting
	 */
	if (no_command || rnd(5) != 0)
	    return;
	no_command += rnd(8) + 4;
	player.t_flags &= ~ISRUN;
	running = FALSE;
	count = 0;
	hungry_state = 3;
	if (on(player, ISTrip)) {
	    if (!terse)
		addmsg("the munchies overpower your motor capabilities.  ");
	    msg("You freak out");
	}
	else {
	    if (!terse)
		addmsg("you feel too weak from lack of food.  ");
	    msg("You faint");
	}
    }
    else
    {
	oldfood = food_left;
	food_left -= ring_eat(LEFT) + ring_eat(RIGHT) + 1 - amulet;

	if (food_left < MORETIME && oldfood >= MORETIME)
	{
	    hungry_state = 2;
	    if (on(player, ISTrip))
		msg("the munchies are interfering with your motor capabilites");
	    else
		msg("you are starting to feel weak");
	}
	else if (food_left < 2 * MORETIME && oldfood >= 2 * MORETIME)
	{
	    hungry_state = 1;
	    if (on(player, ISTrip)) {
		if (!terse)
		    addmsg("you are ");
		msg("getting the munchies");
	    }
	    else
		if (!terse)
		    msg("you are starting to get hungry");
		else
		    msg("getting hungry");
	}
    }
}
Пример #13
0
void KSANEOCR::finishedOCRVisible( bool success )
{
   bool doSpellcheck = m_wantKSpell;

   if( m_ocrProcessDia )
   {
       m_ocrProcessDia->stopOCR();
       doSpellcheck = m_ocrProcessDia->wantSpellCheck();
   }

   if( success )
   {
       QString goof = ocrResultText();

       emit newOCRResultText(goof);

       if( m_imgCanvas )
       {
	   if( m_resultImage != 0 ) delete m_resultImage;
	   kdDebug(28000) << "Result image name: " << m_ocrResultImage << endl;
	   m_resultImage = new QImage( m_ocrResultImage, "BMP" );
	   kdDebug(28000) << "New result image has dimensions: " << m_resultImage->width() << "x" << m_resultImage->height()<< endl;
           /* The image canvas is non-zero. Set it to our image */
           m_imgCanvas->newImageHoldZoom( m_resultImage );
	   m_imgCanvas->setReadOnly(true);

           /* now handle double clicks to jump to the word */
           m_applyFilter=true;
       }

       /** now it is time to invoke the dictionary if required **/
       emit readOnlyEditor( false );

       if( doSpellcheck )
       {
           m_ocrCurrLine = 0;
           /*
            * create a new kspell object, based on the config of the base dialog
            */

           connect( new KSpell( m_parent, i18n("Kooka OCR Dictionary Check"),
                                this, SLOT( slSpellReady(KSpell*)),
                                m_ocrProcessDia->spellConfig() ),
                    SIGNAL( death()), this, SLOT(slSpellDead()));
       }

       delete m_ocrProcessDia;
       m_ocrProcessDia = 0L;

   }

   visibleOCRRunning =  false;
   cleanUpFiles();


   kdDebug(28000) << "# ocr finished #" << endl;
}
Пример #14
0
long
recallplayer(void)
{
	long    loc = 0L;	/* location in player file */
	int     loop;		/* loop counter */
	int     ch;		/* input */

	clear();
	mvprintw(10, 0, "What was your character's name ? ");
	getstring(Databuf, SZ_NAME);
	truncstring(Databuf);

	if ((loc = findname(Databuf, &Player)) >= 0L)
		/* found character */
	{
		Echo = FALSE;

		for (loop = 0; loop < 2; ++loop) {
			/* prompt for password */
			mvaddstr(11, 0, "Password ? ");
			getstring(Databuf, SZ_PASSWORD);
			if (strcmp(Databuf, Player.p_password) == 0)
				/* password good */
			{
				Echo = TRUE;

				if (Player.p_status != S_OFF)
					/* player did not exit normally last
					 * time */
				{
					clear();
					addstr("Your character did not exit normally last time.\n");
					addstr("If you think you have good cause to have your character saved,\n");
					printw("you may quit and mail your reason to 'root'.\n");
					addstr("Otherwise, continuing spells certain death.\n");
					addstr("Do you want to quit ? ");
					ch = getanswer("YN", FALSE);
					if (ch == 'Y') {
						Player.p_status = S_HUNGUP;
						writerecord(&Player, loc);
						cleanup(TRUE);
					}
					death("Stupidity");
				}
				return (loc);
			} else
				mvaddstr(12, 0, "No good.\n");
		}

		Echo = TRUE;
	} else
		mvaddstr(11, 0, "Not found.\n");

	more(13);
	return (-1L);
}
Пример #15
0
//------------------------------------------------------------
void  Enemy::updateSmoke(float time)
{
	m_HurtTime+=time;
	///如果受作超过三秒就死亡
	if(m_HurtTime>=3.0f)
	{
		death();
	}

}
Пример #16
0
void longhelp(void)
{
	
	fprintf(stderr, "Functions in program:\n");
	fprintf(stderr, "ESC\t\t-> quits views and returns to shell\n");
	fprintf(stderr, "F\t\t-> turns fullscreen on\n");
	fprintf(stderr, "N\t\t-> returns to normal window screen (turns fullscreen off)\n");
	fprintf(stderr, "PAGEDOWN\t-> search for next (supported format) file and opens it\n");
	fprintf(stderr, "PAGEUP\t\t-> search for last (supported format) file and opens it\n");
	death();
}
Пример #17
0
/*============================================================================
 * tick
 *========================================================================== */
void org::environment::tick(){
	std::vector<org::entity*>::iterator current,end;

	death();
	entities.reserve(entities.size()*2);//reserve memory for more efficient resizing

	end=entities.end();
	for (current=entities.begin(); current<end; current++){
		this->addEntity((*current)->asex());
	}
	this->log();
}
Пример #18
0
void minion_boss::spawn_slime()
{
    if (slime_number < 10){
        vulnerable = false;
        slime* minion = new slime();
        minion->setPos(x()+100,y()+100);
        minion->setScale(0.4);
        scene()->addItem(minion);
        slime_number++;
        connect(minion,SIGNAL(death()),this,SLOT(slime_death()));
    }
}
Пример #19
0
fuse
unphase(fuse_arg *arg)
{
    NOOP(arg);

    turn_off(player, CANINWALL);

    msg("Your dizzy feeling leaves you.");

    if (!step_ok(hero.y, hero.x, NOMONST, &player))
        death(D_PETRIFY);
}
Пример #20
0
int main() {
    maybe<int> q(1);
    maybe<int> x;
    maybe<get_fucked> death( 1 ); // boom
    maybe<get_fucked> deathagain; // have fun~

    std::cout << std::boolalpha;
    std::cout << (q != nothing) << ' ' << (nothing != q) << ' ';
    std::cout << (x != q) << ' ' << (q != x) << ' ' << (q == q);
    std::cout << ' ' << (q == just(1)) << ' ' << (just(1) == q);
    std::cout << ' ' << (x == x) << ' ' << (x == nothing) << ' ';
    std::cout << ' ' << (nothing == x);
}
Пример #21
0
intrupt(fd_set * readfds)
{
  time_t  time(time_t *);
  unsigned long t;

  udcounter++;

#ifdef RECORDGAME
  if (playback)
    needredraw |= readFromFile();
  else
#endif

    needredraw |=

  readFromServer(readfds);

  t = msetime();
  if (needredraw && (t >= lastredraw + redrawDelay * 100))
    {
      lastredraw = t;
      needredraw = 0;
      lastread = time(NULL);
      redraw();

      updateMaxStats(0);       /* Update the max stats * *
              * <isae> */

#ifdef WIN32
      W_FlushScrollingWindow(messwa);
      W_FlushScrollingWindow(messwt);
      W_FlushScrollingWindow(messwi);
      W_FlushScrollingWindow(messwk);
      W_FlushScrollingWindow(reviewWin);
      W_FlushScrollingWindow(phaserwin);
#endif

      UpdatePlayerList();
    }

  if (reinitPlanets)
    {
      initPlanets();
      reinitPlanets = 0;
    }

  if (me->p_status == POUTFIT)
    {
      death();
    }
}
Пример #22
0
void help(void)
{
        fprintf(stderr, "Help for %s:\n", PACKAGE);
	fprintf(stderr, "%s [OPTIONS] [image|directory]\n\n", PACKAGE);
#ifdef HAVE_WGET
        fprintf(stderr, "\t-u, --url\topens (supported format) file after successful fetch with wget\n");
#endif
	fprintf(stderr, "\t-f, --fs\tstarts views in fullscreen\n");
	fprintf(stderr, "\t-l, --longhelp\tprints long help for views\n");
        fprintf(stderr, "\t-v, --version \tprints version info\n");
        fprintf(stderr, "\t-h, --help \tprints this\n\n");
        author();
        death();
}
Пример #23
0
void Creature::onDeath()
{
	bool lastHitUnjustified = false;
	bool mostDamageUnjustified = false;
	Creature* _lastHitCreature = g_game.getCreatureByID(lastHitCreature);
	Creature* lastHitCreatureMaster;
	if (_lastHitCreature) {
		lastHitUnjustified = _lastHitCreature->onKilledCreature(this);
		lastHitCreatureMaster = _lastHitCreature->getMaster();
	} else {
		lastHitCreatureMaster = nullptr;
	}

	Creature* mostDamageCreature = nullptr;

	const int64_t timeNow = OTSYS_TIME();
	const uint32_t inFightTicks = g_config.getNumber(ConfigManager::PZ_LOCKED);
	int32_t mostDamage = 0;
	for (const auto& it : damageMap) {
		if (Creature* attacker = g_game.getCreatureByID(it.first)) {
			CountBlock_t cb = it.second;
			if ((cb.total > mostDamage && (timeNow - cb.ticks <= inFightTicks))) {
				mostDamage = cb.total;
				mostDamageCreature = attacker;
			}
			attacker->onAttackedCreatureKilled(this);
		}
	}

	if (mostDamageCreature) {
		if (mostDamageCreature != _lastHitCreature && mostDamageCreature != lastHitCreatureMaster) {
			Creature* mostDamageCreatureMaster = mostDamageCreature->getMaster();
			if (_lastHitCreature != mostDamageCreatureMaster && (lastHitCreatureMaster == nullptr || mostDamageCreatureMaster != lastHitCreatureMaster)) {
				mostDamageUnjustified = mostDamageCreature->onKilledCreature(this, false);
			}
		}
	}

	bool droppedCorpse = dropCorpse(_lastHitCreature, mostDamageCreature, lastHitUnjustified, mostDamageUnjustified);
	death(_lastHitCreature);

	if (master) {
		master->removeSummon(this);
	}

	if (droppedCorpse) {
		g_game.removeCreature(this, false);
	}
}
Пример #24
0
void XeenEngine::play() {
	_interface->setup();
	_screen->loadBackground("back.raw");
	_screen->loadPalette("mm4.pal");

	if (getGameID() == GType_DarkSide && !_map->_loadCcNum) {
		_map->_loadCcNum = 1;
		_party->_mazeId = 29;
		_party->_mazeDirection = DIR_NORTH;
		_party->_mazePosition.x = 25;
		_party->_mazePosition.y = 21;
	}

	_map->clearMaze();
	if (_loadSaveSlot >= 0) {
		_saves->newGame();
		_saves->loadGameState(_loadSaveSlot);
		_loadSaveSlot = -1;
	} else {
		_map->load(_party->_mazeId);
	}

	_interface->startup();
	if (_mode == MODE_STARTUP) {
//		_screen->fadeOut();
	}

	(*_windows)[0].update();
	_interface->mainIconsPrint();
	(*_windows)[0].update();
	_events->setCursor(0);

	_combat->_moveMonsters = true;
	if (_mode == MODE_STARTUP) {
		_mode = MODE_INTERACTIVE;
		_screen->fadeIn();
	}

	_combat->_moveMonsters = true;

	gameLoop();

	if (_party->_dead)
		death();

	_mode = MODE_STARTUP;
	_gameMode = GMODE_MENU;
}
Пример #25
0
void Arrow::removeBullet()
{
	bool isMissed = true;
    auto instance = GameManager::getInstance();
   
	auto bulletRect = Rect(this->getPositionX() +this->getParent()->getPositionX() - this->getContentSize().width /2,
                                this->getPositionY() +this->getParent()->getPositionY() - this->getContentSize().height/2,
								this->sprite->getContentSize().width,
                                this->sprite->getContentSize().height );
	
	auto monsterVector = instance->monsterVector;
    
	for (int j = 0; j < monsterVector.size(); j++)
	{
		auto monster = monsterVector.at(j);
		auto monsterRect = monster->baseSprite->getBoundingBox();
			
		if (monsterRect.intersectsRect(bulletRect) && monster->getAttackBySoldier())
		{
			auto currHp = monster->getCurrHp();

			currHp =  currHp - this->getMaxForce() + monster->getArmor();
                
			if(currHp <= 0){
				currHp = 0;
			}
			monster->setCurrHp( currHp );

			monster->getHpBar()->setPercentage((currHp/monster->getMaxHp())*100);
			monster->getHurt();
            isMissed = false;    
			if(currHp == 0){
				monster->death();
			}
			break;
		}
	}
	if(isMissed){

		sprite->setSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("decal_arrow.png"));

		sprite->runAction(Sequence::create(FadeOut::create(1.0f)
										,CallFuncN::create(CC_CALLBACK_0(Bullet::removeFromParent, this))
                                       , NULL));
	}else{
		this->removeFromParent();
	}
}
Пример #26
0
bool plague_update( char_data* ch )
{
  affect_data*  aff;
  int           con;

  if( !is_set( ch->affected_by, AFF_PLAGUE ) ) 
    return FALSE;

  for( int i = 0; ; i++ ) {
    if( i >= ch->affected ) {
      bug( "%s has the plague with no affect??", ch->real_name( ) );
      return FALSE;
      }
    aff = ch->affected[i];
    if( aff->type == AFF_PLAGUE )
      break; 
    }

  con = ch->Constitution( );
  ch->mod_con--;
  aff->level++;

  update_max_hit( ch );
  update_max_move( ch );

  if( con == 3  ) {
    death( ch, NULL, "the plague" );
    return TRUE;
    }

  if( aff->level < 3 ) {
    send( *ch->array, "%s coughs violently.\r\n", ch );
    if( aff->level == 1 ) 
      send( ch, "You cough violently.\r\n" );
    else
      send( "You cough, your throat burning in pain.\r\nThis is much worse than any cold, you have the plague!\r\n", ch );
    return FALSE;
    }

  send( "The plague continues to destroy your body.\r\n", ch );
  send( *ch->array,
    "%s coughs violently, %s has obviously contracted the plague!\r\n",
    ch, ch->He_She( ) );
 
  return FALSE;
}
Пример #27
0
bool spell_acid_blast( char_data* ch, char_data* victim, void* vo,
  int level, int duration )
{
  obj_data*  obj  = (obj_data*) vo;
  int       save;

  /* Quaff */

  if( ch == NULL && obj == NULL ) {
    fsend( victim, "You feel incredible pain as the acid eats away at your\
 stomach and throat.  Luckily you don't feel it for long." );
    fsend_seen( victim, "%s grasps %s throat and spasms in pain - %s does\
 not survive long.", victim, victim->His_Her( ),
      victim->He_She( ) );
    death_message( victim );
    death( victim, NULL, "drinking acid" );
    return TRUE;
    }  
Пример #28
0
void Enemy::updateSwallowBall(float time)
{

	m_HurtTime+=time;
	///如果受作超过三秒就死亡
	if(m_HurtTime>=3.0f)
	{
		death();
	}


	


	//


}
Пример #29
0
void ShipGraphicsObject::gotHit(GameObject* hitter)
{
    QGraphicsPixmapItem* pixmapItem;

    switch(hitter->getType())
    {
    case PROJECTILE:
        if(!((GOM_Ship*)this->getGameObject())->takeDamage(((GOM_Projectile*)hitter)->getDamage()))
        {
            emit death();
        }
        break;
    case POWERUP:
        //get powerup
        //((GOM_Ship*)this->getGameObject())->applyPowerUp(((GOS_PowerUp*)hitter)->getBonus());
        break;

    }
}
Пример #30
0
GameWidget::GameWidget(QWidget *parent): QWidget(parent),
m_scene(new QGraphicsScene(this)), m_view(new QGraphicsView(m_scene, this)){


    count_ref = 0;
    ref = false;
    QGridLayout *layout = new QGridLayout(NULL);
    m_timer = new QTimer(this);

    m_scene->setSceneRect(0,0,400,220);
    m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    layout->setMargin(0);
    m_view->setFixedSize(400,220);
    layout->addWidget(m_view, 0, 0, 1, 1);
    settings = new QSettings("gameSettings");

    m_pet = new Pet();
    m_pet->move(150,60);
    m_pet->action(Nothing);

    connect(m_pet, SIGNAL(chHealthSgn(int)), this,SLOT(chHealthSlt(int)));
    connect(m_pet, SIGNAL(chEnSgn(int)), this, SLOT(chEnSlt(int)));
    connect(m_pet, SIGNAL(chHapSgn(int)), this, SLOT(chHapSlt(int)));
    connect(m_pet, SIGNAL(chSatSgn(int)), this, SLOT(chSatSlt(int)));
    connect(m_timer, SIGNAL(timeout()), this, SLOT(setRefuse()));
    connect(m_pet, SIGNAL(death()), this, SLOT(toKillPet()));
    connect(m_pet, SIGNAL(count_ref(int)), this, SLOT(setRefuses(int)));

    m_scene->addWidget(m_pet);
    m_timer->start(1800000);
    setStyleSheet(
    "* { background-color: rgba(176, 196, 222, 255); }"
                );
      settings = new QSettings("gameSettings");
  //  count_ref = settings->value(m_pet->getPlayer() + "/count_ref").toInt();
  //  qDebug() <<"ffffffffff"<< settings->allKeys();
  //  for(int i = 0; i < count_ref; i++)
  //      setRefuse();
}