void CMyRng::TestIntFromTo() // INTEGER FROM TO //////////////////////////////////////
{
	printf("  Testing INTEGER FROM-TO -------------------------\n");
	int x[11];
	int from=-Dice(5);
	int to=Dice(5);
	printf("    Test task: From %d to %d\n",from,to);
	int i;
	for (i=0;i<11;i++) x[i]=0;
	long t1=time(0);
	for (i=0;i<1e7;i++)
	{
		int q=IntFromTo(from,to);
		q-=from;
		x[q]++;
	}
	long t2=time(0);
	for (i=0;i<(to-from)+1;i++)
	{
		printf("    %2d: %2.1lf%% [%2.1lf%%]\n",
			i+from,((double)x[i]/1e7)*100.0,100.0/(double)(to-from+1));
	}
	printf("    Time: %lds\n",t2-t1);
	printf("\n");
}
Exemple #2
0
void MainWindow::on_Calculate_pressed()
{
    int sum = 0;
    sum += Dice(4).throwDice(ui->spinBoxD4->value(), ui->spinBoxD4Modifier->value());
    sum += Dice(6).throwDice(ui->spinBoxD6->value(), ui->spinBoxD6Modifier->value());
    sum += Dice(8).throwDice(ui->spinBoxD8->value(), ui->spinBoxD8Modifier->value());
    sum += Dice(12).throwDice(ui->spinBoxD12->value(), ui->spinBoxD12Modifier->value());
    sum += Dice(20).throwDice(ui->spinBoxD20->value(), ui->spinBoxD20Modifier->value());
    ui->sumLabel->setText(QString::number(sum));
}
Exemple #3
0
BlueMen::BlueMen()
{
	m_strength = 12;
	m_armor = 3;

	m_defDices.push_back(Dice(6));
	m_defDices.push_back(Dice(6));
	m_defDices.push_back(Dice(6));

	m_atkDices.push_back(Dice(10));
	m_atkDices.push_back(Dice(10));

	m_type = Creature::Type::BLUE_MEN;
}
rvector ZRangeWeaponHitDice::ReturnShotDir()
{
	MakeHitProbability();

	rvector vTargetPos = m_TargetPosition;
	float fRandX=0.0f, fRandY=0.0f;

	float fRandMaxX = m_fTargetWidth+50.0f;
	float fRandMaxY = m_fTargetHeight+20.0f;

	
	if (RandomNumber(0.0f, 1.0f) <= m_fHitProbability)
	{
		float fHeight = m_fTargetHeight * 0.6f * 0.5f;
		float fWidth = m_fTargetWidth * 0.6f * 0.5f;
		// ИэСп
		fRandX = RandomNumber(-fWidth, fWidth);
		fRandY = RandomNumber(-fHeight, fHeight);
	}
	else
	{
		float fHeight = m_fTargetHeight * 0.8f * 0.5f;
		float fWidth = m_fTargetWidth * 0.8f * 0.5f;

		fRandX = RandomNumber(fWidth, fRandMaxX);
		fRandY = RandomNumber(fHeight, fRandMaxY);

		int dice = Dice(1, 2, 0);
		if (dice == 1) fRandX = -fRandX;
		dice = Dice(1, 2, 0);
		if (dice == 1) fRandY = -fRandY;
	}

	rmatrix mat;
	rvector modelDir = vTargetPos - m_SourcePosition;
	Normalize(modelDir);

	rvector tar(0,0,0);
	tar.x += fRandX;
	tar.y += fRandY;

	MakeWorldMatrix(&mat, m_TargetPosition, modelDir, rvector(0,0,1));
	tar = TransformCoord(tar, mat);

	rvector dir = tar - m_SourcePosition;
	Normalize(dir);

	return dir;
}
void CMyRng::TestChoices() // TEST CHOICES ///////////////////////////////////////////
{
	printf("  Testing CHOICES ---------------------------------\n");
	int x[9];
	int numchoice=4+Dice(5);
	double chance[9];
	int i;
	double sum=0;
	for (i=0;i<numchoice;i++) 
	{
		x[i]=0;
		chance[i]=Uniform01()+sum;
		sum+=chance[i];
	}
	for (i=0;i<numchoice;i++)
	{
		chance[i]/=sum;
	}
	long t1=time(0);
	for (i=0;i<1e7;i++)
	{
		int q=Choices(chance);
		x[q]++;
	}
	long t2=time(0);
	for (i=0;i<numchoice;i++)
	{
		printf("    Choice %d (%3.1lf%%): %3.1lf%% [%3.1lf%%]\n",i,
			100.0*chance[i],((double)x[i]/1e7)*100.0,100.0*chance[i]);
	}
	printf("    Time: %lds\n",t2-t1);
	printf("\n");
}
Exemple #6
0
    Dice EntityStats::getDiceEsq(int value)
    {
        int nb;
        int min;
        int max;

        if(value<=15)
        {
            nb=0;
            min=0;
            max=0;
        }
        else if (value <=17)
        {
            nb=1;
            min=20;
            max=20;
        }
        else if (value <=19)
        {
            nb=1;
            min=19;
            max=20;
        }
        else if (value <=28)
        {
            nb=1;
            min=32 - value/1.4;
            max=20;
        }
        else if (value <=30)
        {
            nb=1;
            min=9;
            max=20;
        }
        else if (value <=35)
        {
            nb=1;
            min=8;
            max=20;
        }
        else if (value <=39)
        {
            nb=1;
            min=7;
            max=20;
        }
        else
        {
            nb=1;
            int tmp = 10 - value/10;
            min=tmp>4?tmp:4;
            max=20;
        }

        return Dice(Dice::Type::Condition,nb,max,min);
    }
Exemple #7
0
    Dice EntityStats::getDiceInt(int value)
    {
        if (value > 20)
            return Dice(Dice::Type::Normal,0,0,0);

        int nb = 2;
        int min = 1;
        int max;

        if(value <= 0)
            max = 3;
        else if( value <= 10)
            max = 6;
        else// if(value <= 20)
            max = 10;

        return Dice(Dice::Type::Double,nb,max,min);
    }
entityx::Entity EntityFactory::create_goblin() {
  entityx::Entity goblin = entities_->create();
  goblin.assign<Aspect>(Aspect::make('g', TB_GREEN, TB_BLACK));
  goblin.assign<Spatial>(Spatial::make());
  goblin.assign<Script>(Script::make("scripts/goblin.lua"));
  goblin.assign<TurnTaker>(TurnTaker::make());
  goblin.assign<Health>(Health::make(Dice(1, 6)));
  goblin.assign<FactionMember>(FactionMember::make(kFactionEverythingElse));
  goblin.assign<Descriptor>(Descriptor::make("Goblin"));
  return goblin;
}
entityx::Entity EntityFactory::create_player() {
  entityx::Entity player = entities_->create();
  player.assign<Aspect>(Aspect::make('@', TB_WHITE | TB_BOLD, TB_BLACK));
  player.assign<Spatial>(Spatial::make());
  player.assign<Script>(Script::make("scripts/player.lua"));
  player.assign<TurnTaker>(TurnTaker::make());
  player.assign<Health>(Health::make(Dice(1, 8)));
  player.assign<FactionMember>(FactionMember::make(kFactionPlayer));
  player.assign<Descriptor>(Descriptor::make("Player"));
  player.assign<FieldOfView>(FieldOfView::make(10));
  return player;
}
CCQuestLevel* CCQuestLevelGenerator::MakeLevel()
{
	// 시나리오 결정
	m_nScenarioID = MakeScenarioID();


	// 주사위 굴림
	int dice = (int)Dice(1, SCENARIO_STANDARD_DICE_SIDES, 0);

	CCQuestLevel* pNewLevel = new CCQuestLevel();
	pNewLevel->Init(m_nScenarioID, dice, m_eGameType);

	return pNewLevel;
}
void CMyRng::TestDice() // DICE TEST /////////////////////////////////////////////////
{
	printf("  Testing DICE ------------------------------------\n");
	int x[10];
	int i;
	for (i=0;i<10;i++) x[i]=0;
	long t1=time(0);
	for (i=0;i<1e7;i++)
	{
		int q=Dice(10)-1;
		x[q]++;
	}
	long t2=time(0);
	for (i=0;i<10;i++)
	{
		printf("    %2d: %1.1lf%% [10.0%%]\n",i+1,((double)x[i]/1e7)*100.0);
	}
	printf("    Time: %lds\n",t2-t1);
	printf("\n");
}
Exemple #12
0
//Вычисление числа, которое игрок может использовать в качестве характеристики
int MainWindow::calculateCandidatToBecomeAbility()
{
    int arrayOfD6Throws[3];

    for (int i = 0; i < 4; i++){
        arrayOfD6Throws[i] = Dice(6).throwDice(1, 0);
    }

    for(int i = 0; i < 3; i++)
    {
        for(int j = i + 1; j < 4; j++)
        {
            if (arrayOfD6Throws[i] < arrayOfD6Throws[j])
            {
                int temp = arrayOfD6Throws[i];
                arrayOfD6Throws[i] = arrayOfD6Throws[j];
                arrayOfD6Throws[j] = temp;
            }
        }
    }

    int sum = arrayOfD6Throws[0] + arrayOfD6Throws[1] + arrayOfD6Throws[2];
    return sum;
}
character_t *Place_Player(Dungeon_Space_Struct **dungeon, int *seed)
{
	pos_t *open_pos = (pos_t *) malloc(sizeof(pos_t));
	open_pos[0] = NULL_POS;
	character_t *player;
	
	int x, y, open_count = 0;
	for(x = 0; x < 80; x++)
	{
		for(y = 0; y < 21; y++)
		{
			pos_t new_pos;
			switch(dungeon[x][y].space_type)
			{
				case ROCK:
				break;
				
				case ROOM:
					new_pos.x = x;
					new_pos.y = y;
					open_count++;
					open_pos = (pos_t *) realloc(open_pos, sizeof(pos_t) + (sizeof(pos_t) * open_count));
					open_pos[open_count-1] = new_pos;
					open_pos[open_count] = NULL_POS;
				break;
				
				case CORRIDOR:
					new_pos.x = x;
					new_pos.y = y;
					open_count++;
					open_pos = (pos_t *) realloc(open_pos, sizeof(pos_t) + (sizeof(pos_t) * open_count));
					open_pos[open_count-1] = new_pos;
					open_pos[open_count] = NULL_POS;
				break;
			}
		}
	}
	
	int seed_local;
	
	if(*seed <= 0)
	{
		seed_local = time(NULL);
		*seed = seed_local;
	}
	else if(*seed > 0)
	{
		seed_local = *seed;
	}
	srand(seed_local);
	pos_t new_pos = open_pos[rand()%open_count];
	pc = new_Player_param("Edwin");
	//pc.name = "Edwin";
	player = (character_t *) pc;//character_tag_create(10, 0, 0, TRUE, new_pos, dungeon[new_pos.x][new_pos.y], PLAYER, pc);
	set_Character_all(player, 10, 0, 0, (boolean) TRUE, new_pos, dungeon[new_pos.x][new_pos.y], PLAYER);
	set_Character_healthPoints(player, 1000);
	set_Character_parsed_data(player, "Dr. Sheaffer", "Professor of ComS 327", '@', 6, Dice(0, 1, 4));
	set_Character_magicPoints(player, 1000);
	create_character_list();
	add_character(player);
	free(open_pos);
	return player;
}
Exemple #14
0
int main()
{
	Initialize( "ºÎ¸£¸¶ºí", NULL, NULL );
	Dice();
	return 0;
}
Exemple #15
0
Dice Dice::base() const
{
  return Dice(number, sides, bonus);
}
Exemple #16
0
void Progress()
{
	int i;
	int vs1, vs2;
	int result[3]={0};

	for(i=0; i<3; i++)
	{
		vs1=Dice();
		vs2=Dice();

		printf("\n########## %d번째 게임 ##########\n", i+1);
		printf(" 민수: %d \t민수의 친구: %d\n", vs1, vs2);

		if(vs1>vs2)
		{
			VSPrint(0);
			result[0]++;
		}
		else if(vs1<vs2)
		{
			VSPrint(1);
			result[1]++;
		}
		else
		{
			VSPrint(2);
			result[2]++;
		}
		
		system("PAUSE");
	}

	puts("\n---------------------------------------------------");
	printf("민수가 이긴 횟수: %d \n", result[0]);
	printf("민수의 친구가 이긴 횟수: %d \n", result[1]);
	printf("비긴 횟수: %d \n", result[2]);
	puts("---------------------------------------------------");

	if(result[0]>result[1])
	{
		VSPrint(0);
		if(choice==1)
		{
			puts("당신은 배팅금의 2배를 얻었습니다.");
			money+=bet;
		}
		else
		{
			puts("당신은 배팅금만큼의 돈을 잃었습니다.");
			money-=bet;
		}
	}
	else if(result[0]<result[1])
	{
		VSPrint(1);
		if(choice==2)
		{
			puts("당신은 배팅금의 2배를 얻었습니다.");
			money+=bet;
		}
		else
		{
			puts("당신은 배팅금만큼의 돈을 잃었습니다.");
			money-=bet;
		}
	}
	else
		VSPrint(2);

	puts("---------------------------------------------------\n");
}
Exemple #17
0
//--------------------------------------------------------------------------------
// 지정 시간이 되면 날씨를 알아서 바꿔준다. 존의 heartbeat 에서 호출되어야 한다.
//--------------------------------------------------------------------------------
void WeatherManager::heartbeat () 
	throw(Error)
{
	// 노멀 필드가 아니라면 아무 것도 할 필요가 없다.
	if (m_pZone->getZoneType() != ZONE_NORMAL_FIELD) return;

	// PK 존도 아무것도 할 필요가 없다.
	if (g_pPKZoneInfoManager->isPKZone(m_pZone->getZoneID() ) )
		return;

	time_t currentTime = time(0);

	//--------------------------------------------------------------------------------
	// 하루가 지나간 경우, 오늘의 날씨를 바꾸고, 날씨별 확률을 계산한다.
	// 오늘의 날씨가 바뀌더라도, m_NextWeatherChangingTime 을 넘어서지
	// 않았다면 날씨는 바뀌지 않는다는 데 유의할 것.
	//--------------------------------------------------------------------------------
	if (currentTime > m_Tomorrow) 
	{
		// 오늘이 몇월인지 알기 위해서, GameTime 객체를 가져온다.
		GameTime gametime = g_pTimeManager->getGameTime();

		// 이번달의 날씨 정보를 받아온다.
		const WeatherInfo & weatherInfo = g_pWeatherInfoManager->getWeatherInfo(gametime.getMonth());

		// 다이스를 굴려서, 오늘의 날씨를 지정한다.
		m_TodayWeather = weatherInfo.getWeather(Dice(1,100));

		// 비/눈이 올 확률을 결정한다.
		// 현재 날씨는 다음날씨변경시간이 지나야만 변경된다.
		// 따라서 여기서 설정해줄 필요는 없다.
		if (m_TodayWeather == WEATHER_CLEAR) 
		{
			// 맑은 날은 무조건 맑다.
			m_Probability = 0;
		} 
		else 
		{
			m_Probability = Dice(3,100) / 3;
		}

		// 게임시간을 time_t 로 받아온다.
		time_t gmtime = g_pTimeManager->getgametime();

		// tm 스트럭처로 변환, 시/분/초 값을 알아낸다.
		tm ltm;
		localtime_r(&gmtime, &ltm);
		//struct tm* ptm = localtime(&gmtime);

		// 게임 시간으로 내일까지 남은 초를 계산한다.
		int dSec = (23 - ltm.tm_hour)* 3600 + (59 - ltm.tm_min)* 60 + (59 - ltm.tm_sec);

		// (남은 게임 시간 / 5) 를 현재 실시간에 더하면, 내일의 실제 시간이 나온다.
		m_Tomorrow = currentTime + dSec / 5;
	}

	//--------------------------------------------------------------------------------
	// 지정된 시간을 초과한 경우, 날씨를 바꿔줘야 한다.
	//--------------------------------------------------------------------------------
	if (currentTime > m_NextWeatherChangingTime) 
	{
		if (m_TodayWeather == WEATHER_CLEAR) 
		{
			// 맑은 날의 경우, 내일까지 아무런 날씨 변화도 발생하지 않는다.
			m_CurrentWeather = WEATHER_CLEAR;
			m_WeatherLevel = 0;
			m_NextWeatherChangingTime = m_Tomorrow;
			m_NextLightning = m_Tomorrow / 2;
		} 
		else 
		{
			m_CurrentWeather = (Dice(1,100) < m_Probability) ? m_TodayWeather : WEATHER_CLEAR ;
			m_WeatherLevel = (m_CurrentWeather!=WEATHER_CLEAR) ? Dice(3,20) / 3 : 0;

			// 일단 테스트를 위해서 주기를 짧게
			//m_NextWeatherChangingTime = time(0) + Dice(1,20)* 60;
			m_NextWeatherChangingTime = time(0) + 60;

			// 일단 테스트를 위해 주기를 짧게
			//m_NextLightning = time(0) + 60;
			m_NextLightning = time(0) + 20;
		}

		GCChangeWeather gcChangeWeather;
		gcChangeWeather.setWeather(m_CurrentWeather);
		gcChangeWeather.setWeatherLevel(m_WeatherLevel);

		//StringStream msg;
		//msg << "ZONE[" << m_pZone->getZoneID() << "] : " << gcChangeWeather.toString();
		//log(LOG_DEBUG_MSG, "", "", msg.toString());

		m_pZone->broadcastPacket(&gcChangeWeather , NULL);
	}

	//--------------------------------------------------------------------------------
	// 오늘의 날씨가 '비' 이면서, 지정된 시간을 초과한 경우, 번개 체크를 해준다.
	//--------------------------------------------------------------------------------
	if (m_CurrentWeather == WEATHER_RAINY && currentTime > m_NextLightning) 
	{
		// 1d100 다이스를 굴려서, (비의 레벨* 5 - 30) 보다 작다면
		// 번개가 친 것으로 간주한다. 날씨 레벨이 최대 20 이므로,
		// 확률은 최대 70% 까지 도달할 수 있다.
		// 일단 무조건 비가 오면 번개가 치도록 한당..
		if (Dice(1 , 100) < (uint)max(0 , m_WeatherLevel* 5 - 30)) 
		{
			GCLightning gcLightning;
			gcLightning.setDelay(Dice(1,5));
			m_pZone->broadcastPacket(&gcLightning , NULL);
		}

		// 다음 번개 체크 시간을 설정한다.
		// (날씨가 맑을 경우에는 증가시켜줄 필요조차 없다.)
		m_NextLightning += 60;
	}

	//--------------------------------------------------------------------------------
	// 게임 시간 10분마다 존의 밝기와 어둡기 정보를 바꿔준다.
	//--------------------------------------------------------------------------------
	if (currentTime > m_Next10Min) 
	{
		DarkLightInfo* pDIInfo = g_pDarkLightInfoManager->getCurrentDarkLightInfo(m_pZone);

		DarkLevel_t darkLevel = pDIInfo->getDarkLevel();
		LightLevel_t lightLevel = pDIInfo->getLightLevel();

		// 어둡기나 밝기 중 하나라도 바뀌었다면.. 브로드캐스트한다.
		if (darkLevel != m_pZone->getDarkLevel() || lightLevel != m_pZone->getLightLevel()) 
		{
			m_pZone->setDarkLevel(darkLevel);
			m_pZone->setLightLevel(lightLevel);

			GCChangeDarkLight gcChangeDarkLight;
			gcChangeDarkLight.setDarkLevel(darkLevel);
			gcChangeDarkLight.setLightLevel(lightLevel);

			GCChangeDarkLight gcChangeDarkLight2;
			gcChangeDarkLight2.setDarkLevel(DARK_MAX - darkLevel);
			gcChangeDarkLight2.setLightLevel(LIGHT_MAX - lightLevel);

			m_pZone->broadcastDarkLightPacket(&gcChangeDarkLight, &gcChangeDarkLight2, NULL);

			//cout << "(DarkLevel/LightLevel) : (" << (int)darkLevel << "," << (int)lightLevel << ") at " << g_pTimeManager->getGameTime().toString() << endl;
		}
		else
		{
			//cout << "(DarkLevel/LightLevel) : (" << (int)darkLevel << "," << (int)lightLevel << ") at " << g_pTimeManager->getGameTime().toString() << endl;
		}

		m_Next10Min += 120;
	}
}
//Structors
GameEngine::GameEngine(char* title, int xScreenRes, int yScreenRes, char* tiles, int tileSize, int tileRes, int worldSize) {
	lib.init(title, xScreenRes, yScreenRes, tiles, tileSize, tileRes);
	this->worldSize = worldSize;
	currLevel = 1;

	screenOrientation = lib.res() / 2;

	//Add monster table
	actordefs = { rat, spider, ant, bee, beetle, snake, dingo, fox, plant, puppy,
		          giant_rat, tarantula, fire_ant, hornet, snow_wolf, werewolf, hyena, 
				  eye_djinn, cerberus, tent_mon, priest, hpriest, sad_bag, ass_goblin 
	};

	//Add boss table
	bossdefs = { boss1, boss2, boss3, boss4, boss5, boss6 };

	hero = new Hero(main, Point(0, 0), true);

	//Add pickup table stuff for sloppy
	pickupdefs = {
		//health pots
		PickupDef(0x227, "Small Health Potion", "Restores 10 HP", 1, 100, [&]() { hero->changeHP(10); }),
		PickupDef(0x237, "Big Health Potion", "Restores 20 HP", 2, 200, [&]() { hero->changeHP(20); }),
		PickupDef(0x220, "Large Health Potion", "Restores 30 HP", 3, 300, [&]() { hero->changeHP(30); }),

		//mana pots
		PickupDef(0x22A, "Small Mana Potion", "Restores 5 mana", 1, 100, [&]() { hero->changeMana(5); }),
		PickupDef(0x23A, "Mana Potion", "Restores 10 mana", 2, 100, [&]() { hero->changeMana(10); }),
		PickupDef(0x223, "Large Mana Potion", "Restores 20 mana", 3, 300, [&]() { hero->changeMana(20); }),

		//helms
		PickupDef(0x2DC, "Crude Helmet", "Increases defense by 1", 1, 5, 1, 100, [&]() { hero->changeDEF(1); }, [&]() { hero->changeDEF(-1); }),
		PickupDef(0x2DD, "Steel Helmet", "Increases defense by 2", 1, 5, 2, 200, [&]() { hero->changeDEF(2); }, [&]() { hero->changeDEF(-2); }),
		PickupDef(0x2D9, "Magician's Hat", "Increases max health by 10", 1, 5, 4, 400, [&]() { hero->changeMaxHP(10); }, [&]() { hero->changeMaxHP(-10); }),

		//necks
		PickupDef(0x337, "Worn Necklace", "Increases max health by 5", 2, 10, 1, 100, [&]() { hero->changeMaxHP(5); }, [&]() { hero->changeMaxHP(-5); }),
		PickupDef(0x338, "Fine Necklace", "Increases defense by 2", 2, 5, 2, 200, [&]() { hero->changeDEF(2); }, [&]() { hero->changeDEF(-2); }),
		PickupDef(0x33B, "Cross of Al'tair", "Increases defense by 4", 2, 5, 4, 400, [&]() { hero->changeDEF(4); }, [&]() { hero->changeDEF(-4); }),

		//shirts
		PickupDef(0x2D0, "Tattered Shirt", "Increases max health by 5", 3, 5, 1, 100, [&]() { hero->changeMaxHP(5); }, [&]() { hero->changeMaxHP(-5); }),
		PickupDef(0x2D1, "Gold Chainmail", "Increases max health by 10", 3, 5, 2, 200, [&]() { hero->changeMaxHP(10); }, [&]() { hero->changeMaxHP(-10); }),
		PickupDef(0x2D2, "Vest of the Thief's Guild", "Increases defense by 3", 3, 5, 4, 400, [&]() { hero->changeDEF(3); }, [&]() { hero->changeDEF(-3); }),

		//gloves
		PickupDef(0x2E7, "Worn Leather Glove", "Increases defense by 1", 4, 4, 1, 100, [&]() { hero->changeDEF(1); }, [&]() { hero->changeDEF(-1); }),
		PickupDef(0x2E9, "Chainmail Glove", "Increases defense by 2", 4, 4, 2, 200, [&]() { hero->changeDEF(2); }, [&]() { hero->changeDEF(-2); }),
		PickupDef(0x2EA, "Glove of the Magi", "Increases max health by 10", 4, 4, 4, 400, [&]() { hero->changeMaxHP(10); }, [&]() { hero->changeMaxHP(-10); }),

		//shoes
		PickupDef(0x2E1, "Smelly Old Shoe", "Increases defense by 1", 5, 5, 1, 100, [&]() { hero->changeDEF(1); }, [&]() { hero->changeDEF(-1); }),
		PickupDef(0x2E2, "Fine Leather Shoe", "Increases defense by 2", 5, 5, 2, 200, [&]() { hero->changeDEF(2); }, [&]() { hero->changeDEF(-2); }),
		PickupDef(0x2E3, "Knight's Boot", "Increases defense by 3", 5, 5, 4, 400, [&]() { hero->changeDEF(3); }, [&]() { hero->changeDEF(-3); }),

		//journals
		PickupDef(0x3D1, "Standard Spell Journal", "Increases max health by 5", 6, 10, 1, 100, [&]() { hero->changeMaxHP(5); }, [&]() { hero->changeMaxHP(-5); }),
		PickupDef(0x3D3, "Mage's Necronomicon", "Increases max health by 7", 6, 10, 2, 200, [&]() { hero->changeMaxHP(7); }, [&]() { hero->changeMaxHP(-7); }),
		PickupDef(0x3D4, "Death Note", "Increases max health by 9", 6, 10, 4, 400, [&]() { hero->changeMaxHP(9); }, [&]() { hero->changeMaxHP(-9); }),

		//swords
		PickupDef(0x260, "Crude Dagger", "Attack: (2, 14)", 7, 5, 1, 100, [&]() { hero->changeATK(Dice(7, 2)); }, [&]() { hero->revertATK(); }),
		PickupDef(0x253, "Fine Longsword", "Attack: (3, 15)", 7, 5, 2, 200, [&]() { hero->changeATK(Dice(5, 3)); }, [&]() { hero->revertATK(); }),
		PickupDef(0x2A2, "Ogre's Battleaxe", "Attack: (4, 16)", 7, 5, 3, 300, [&]() { hero->changeATK(Dice(4, 4)); }, [&]() { hero->revertATK(); }),

		//shields
		PickupDef(0x2C0, "Broken Shield", "Increases defense by 1", 8, 2, 1, 100, [&]() { hero->changeDEF(1); }, [&]() { hero->changeDEF(-1); }),
		PickupDef(0x2C2, "Fine Wooden Shield", "Increases defense by 4", 8, 2, 2, 200, [&]() { hero->changeDEF(4); }, [&]() { hero->changeDEF(-4); }),
		PickupDef(0x2C3, "Tower Shield", "Increases defense by 5", 8, 2, 4, 400, [&]() { hero->changeDEF(5); }, [&]() { hero->changeDEF(-5); })
	};

	//Legendary items
	legendarydefs = {
		PickupDef(0x2D7, "Hakar's Skull", "Increases defense by 7", 1, 15, 4, 4000, [&]() { hero->changeDEF(7); }, [&]() { hero->changeDEF(-7); }),
		PickupDef(0x336, "Akator's Blessing", "Increases defense by 6", 2, 15, 4, 4000, [&]() { hero->changeDEF(6); }, [&]() { hero->changeDEF(-6); }),
		PickupDef(0x2D6, "Hakar's Skin", "Increases defense by 7", 3, 15, 4, 4000, [&]() { hero->changeDEF(7); }, [&]() { hero->changeDEF(-7); }),
		PickupDef(0x2ED, "Shadowborn Glove", "Increases max health by 40", 4, 15, 4, 4000, [&]() { hero->changeMaxHP(40); }, [&]() { hero->changeMaxHP(-40); }),
		PickupDef(0x2E5, "Shadowborn Shoe", "Increases defense by 5", 5, 15, 4, 4000, [&]() { hero->changeDEF(5); }, [&]() { hero->changeDEF(-5); }),
		PickupDef(0x3D6, "Hakar's Bible", "Increases max health by 50", 6, 15, 4, 4000, [&]() { hero->changeMaxHP(50); }, [&]() { hero->changeMaxHP(-50); }),
		PickupDef(0x390, "Akator's Right Hand", "Attack: (10, 20)", 7, 15, 4, 4000, [&]() { hero->changeATK(Dice(10, 2)); }, [&]() { hero->revertATK(); }),
		PickupDef(0x2C4, "Hakar's Left Hand", "Increases defense by 6", 8, 15, 4, 4000, [&]() { hero->changeDEF(6); }, [&]() { hero->changeDEF(-6); }),
	};

	//Set up MessageLog / Inventory
	log.init(&lib);
	invLog.init(&lib, hero, &log);

	generateLevel();
}
Exemple #19
0
    Dice EntityStats::getDiceRefLibre(int value)
    {
        int nb = 1;
        int min;
        int max;

        if(value <=0)
        {
            int tmp = 16 - value;
            min = tmp<80?tmp:80;
            max = 100;
        }
        else if (value <= 7)
        {
            min = 13;
            max = 100;
        }
        else if(value <12)
        {
            min = 11;
            max = 99;
        }
        else if(value <16)
        {
            min = 9;
            max = 98;
        }
        else if(value <20)
        {
            min = 7;
            max = 97;
        }
        else if(value <27)
        {
            min = 5;
            max = 96;
        }
        else if(value <30)
        {
            min = 5;
            max = 92;
        }
        else if(value <34)
        {
            min = 4;
            max = 90;
        }
        else if(value <38)
        {
            min = 3;
            max = 86;
        }
        else
        {
            min = 5-value/20;
            if(min <1)
                min = 1;
            max = 79-value;
            if(max<2)
                max = 2;
        }
        return Dice(Dice::Type::Libre,nb,max,min);

    }
Exemple #20
0
    Dice EntityStats::getDiceRef(int value)
    {
        int nb;
        int min;
        int max;
        if(value <= 0)
        {
            nb=0;
            min=0;
            max=0;
        }
        else if (value <= 3)
        {
            nb=1;
            min=1;
            max=3;
        }
        else if(value <=6)
        {
            nb=1;
            min=1;
            max=4;
        }
        else if(value <=10)
        {
            nb=1;
            min=1;
            max=6;
        }
        else if(value <=18)
        {
            nb=1;
            min=1;
            max=8;
        }
        else if(value <=23)
        {
            nb=1;
            min=1;
            max=10;
        }
        else if(value <=29)
        {
            nb=1;
            min=1;
            max=12;
        }
        else if(value <=36)
        {
            nb=1;
            min=1;
            max=20;
        }
        else if(value <=44)
        {
            nb=1;
            min=1;
            max=40;
        }
        else if(value <=55)
        {
            nb=1;
            min=1;
            max=60;
        }
        else if(value <=70)
        {
            nb=1;
            min=1;
            max=80;
        }
        else
        {
            nb=value/20 - 2;
            min=1;
            max=100;
        }

        return Dice(Dice::Type::Augmente,nb,max,min);
    }
Exemple #21
0
    Dice EntityStats::getDiceDef(int value)
    {
        int nb;
        int min;
        int max;

        if(value <= 0)
        {
            nb=0;
            min=0;
            max=0;
        }
        else if (value <= 3)
        {
            nb=1;
            min=1;
            max=3;
        }
        else if (value <= 7)
        {
            nb=1;
            min=1;
            max=4;
        }
        else if (value <= 13)
        {
            nb=1;
            min=1;
            max=6;
        }
        else if (value <= 20)
        {
            nb=1;
            min=1;
            max=8;
        }
        else if (value <= 28)
        {
            nb=1;
            min=1;
            max=10;
        }
        else if (value <= 35)
        {
            nb=1;
            min=1;
            max=12;
        }
        else if (value <= 40)
        {
            nb=1;
            min=1;
            max=20;
        }
        else if (value <= 50)
        {
            nb=1;
            min=1;
            max=40;
        }
        else if (value <= 60)
        {
            nb=1;
            min=1;
            max=60;
        }
        else if (value <= 70)
        {
            nb=1;
            min=1;
            max=80;
        }
        else
        {
            nb=value/30 - 1;
            min=1;
            max=100;
        }
        return Dice(Dice::Type::Augmente,nb,max,min);
    }