Skip to content

Commit

Permalink
July 29 update and merge
Browse files Browse the repository at this point in the history
  • Loading branch information
xulai1001 committed Jul 29, 2024
2 parents f1ec1ae + 46ea14d commit ca88122
Show file tree
Hide file tree
Showing 21 changed files with 4,298 additions and 156 deletions.
585 changes: 585 additions & 0 deletions Scripts/export_support_card/cardDB.json

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions Scripts/export_support_card/umaDB.json
Original file line number Diff line number Diff line change
Expand Up @@ -2831,6 +2831,41 @@
],
"star": 5
},
"103703": {
"bonusData": [],
"fiveStatusBonus": [
0,
10,
0,
10,
10
],
"fiveStatusInitial": [
116,
101,
106,
107,
120
],
"freeRaces": [],
"gameId": 103703,
"name": "[Reines Plätschern]エイシンフラッシュ",
"preferRaces": [],
"preferReds": [],
"races": [
11,
24,
30,
33,
45,
47,
53,
55,
67,
71
],
"star": 5
},
"103801": {
"bonusData": [],
"fiveStatusBonus": [
Expand Down Expand Up @@ -6031,6 +6066,46 @@
],
"star": 5
},
"109902": {
"bonusData": [],
"fiveStatusBonus": [
15,
10,
0,
0,
5
],
"fiveStatusInitial": [
111,
103,
105,
112,
119
],
"freeRaces": [
{
"startTurn": 12,
"endTurn": 30,
"count": 1
}
],
"gameId": 109902,
"name": "[パステルマリン・ロコドル]ホッコータルマエ",
"preferRaces": [],
"preferReds": [],
"races": [
11,
38,
46,
50,
56,
59,
68,
70,
71
],
"star": 5
},
"110001": {
"bonusData": [],
"fiveStatusBonus": [
Expand Down
1 change: 1 addition & 0 deletions UmaSimulator/Game/Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct Action
static const std::string dishName[14];
static const Action Action_RedistributeCardsForTest;
static const int MAX_ACTION_TYPE = 21;//标准的Action有编号,8+13=21种
static const int MAX_TWOSTAGE_ACTION_TYPE = 21 + 8 + 8;//二阶段搜索考虑的最多Action个数,只有两种1级菜需要考虑二阶段搜索,8+13+2*8=37种


int16_t dishType;//做菜,0为不做菜
Expand Down
41 changes: 26 additions & 15 deletions UmaSimulator/Game/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,8 @@ void Game::autoUpgradeFarm(bool beforeXiahesu)
return;

//升级路线:32333 42443 43443 43453 53553
int value[5] = { 160,20,180,200,40 };//优先级
int value[5] = { 283,140,281,282,160 };//优先级
int priorLv5[5] = { 3,1,4,5,2 };//优先级
//根据lv调整权重
for (int i = 0; i < 5; i++)
{
Expand Down Expand Up @@ -888,7 +889,10 @@ void Game::autoUpgradeFarm(bool beforeXiahesu)
}
for (int i = 0; i < 5; i++)
{
value[i] += clickNums[i] * 10;
if (cook_farm_level[i] <= 3)
value[i] += clickNums[i] * 15;
else
value[i] += 3 * priorLv5[i];
int overflow = 55 + 45 * clickNums[i] + cook_material[i] - GameConstants::Cook_MaterialLimit[cook_farm_level[i]];
if (overflow > 0)
value[i] += overflow;
Expand Down Expand Up @@ -1038,13 +1042,12 @@ std::vector<int> Game::dishBigSuccess_getBuffs(int dishId, std::mt19937_64& rand


}
int Game::calculateRealStatusGain(int idx, int value) const//考虑1200以上为2的倍数的实际属性增加值
int Game::calculateRealStatusGain(int value, int gain) const//考虑1200以上为2的倍数的实际属性增加值
{
if (idx == 5)return value;
int newValue = fiveStatus[idx] + value;
if (newValue <= 1200)return value;
if (value == 1)return 2;
return (newValue / 2) * 2 - fiveStatus[idx];
int newValue = value + gain;
if (newValue <= 1200)return gain;
if (gain == 1)return 2;
return (newValue / 2) * 2 - value;
}
void Game::addStatus(int idx, int value)
{
Expand Down Expand Up @@ -1163,8 +1166,9 @@ void Game::runRace(int basicFiveStatusBonus, int basicPtBonus)

int fiveStatusBonus = int(dishMultiply * int(raceMultiply * basicFiveStatusBonus));
int ptBonus = int(dishMultiply * int(raceMultiply * basicPtBonus));
//cout << fiveStatusBonus << " " << ptBonus << endl;
addAllStatus(fiveStatusBonus);
skillPt += basicPtBonus;
skillPt += ptBonus;
}

void Game::addStatusFriend(int idx, int value)
Expand Down Expand Up @@ -1248,7 +1252,7 @@ void Game::handleFriendOutgoing(std::mt19937_64& rand)
void Game::handleFriendUnlock(std::mt19937_64& rand)
{
assert(friend_stage == FriendStage_beforeUnlockOutgoing);
if (maxVital - vital >= 20)
if (maxVital - vital >= 40)
{
addVitalFriend(25);
printEvents("友人外出解锁!选上");
Expand Down Expand Up @@ -1670,7 +1674,7 @@ bool Game::isLegal(Action action) const

float Game::getSkillScore() const
{
float rate = isQieZhe ? ptScoreRate : ptScoreRate * 1.1;
float rate = isQieZhe ? ptScoreRate * 1.1 : ptScoreRate ;
return rate * skillPt + skillScore;
}

Expand Down Expand Up @@ -1849,12 +1853,17 @@ void Game::calculateTrainingValueSingle(int tra)
{
int lower = trainValueLower[tra][i];
if (lower > 100) lower = 100;
lower = calculateRealStatusGain(i, lower);//consider the integer over 1200
trainValueLower[tra][i] = lower;
double multiplier = i < 5 ? scenarioTrainMultiplier : skillPtMultiplier;
int total = int(lower * multiplier);
if (total > 100 + lower)total = 100 + lower;
total = calculateRealStatusGain(i, total);
int upper = total - lower;
if (upper > 100)upper = 100;
if (i < 5)
{
lower = calculateRealStatusGain(fiveStatus[i], lower);//consider the integer over 1200
upper = calculateRealStatusGain(fiveStatus[i] + lower, upper);
}
total = upper + lower;
trainValue[tra][i] = total;
}

Expand Down Expand Up @@ -1887,10 +1896,12 @@ int Game::getDishTrainingBonus(int trainIdx) const
return 25;
else if (dishLevel == 2)
{
int b = 60;
int b = 50;
int mainTrainingIdx = GameConstants::Cook_DishMainTraining[cook_dish];
if (cook_farm_level[mainTrainingIdx] >= 5)
b += 10;
if (turn >= 36)
b += 10;
return b;
}
else if (dishLevel == 3)
Expand Down
2 changes: 1 addition & 1 deletion UmaSimulator/Game/Game.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ struct Game
return turn >= 13 && turn <= 71;
}

int calculateRealStatusGain(int idx, int value) const;//考虑1200以上为2的倍数的实际属性增加值
int calculateRealStatusGain(int value, int gain) const;//考虑1200以上为2的倍数的实际属性增加值
void addStatus(int idx, int value);//增加属性值,并处理溢出
void addAllStatus(int value);//同时增加五个属性值
void addVital(int value);//增加或减少体力,并处理溢出
Expand Down
2 changes: 1 addition & 1 deletion UmaSimulator/Game/Person.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void Person::setExtraDeyilvBonus(int deyilvBonus)
{
if (personType == PersonType_card)
{
int newDeyilv = int(cardParam.deYiLv) + deyilvBonus;
int newDeyilv = int((100.0 + cardParam.deYiLv) * (1.00 + 0.01 * deyilvBonus) - 100); //我不知道这里应该加还是乘,但设成乘更能模拟胡局
std::vector<int> probs = { 100,100,100,100,100,50 }; //基础概率,速耐力根智鸽
probs[cardParam.cardType] += newDeyilv;
distribution = std::discrete_distribution<>(probs.begin(), probs.end());
Expand Down
11 changes: 8 additions & 3 deletions UmaSimulator/Game/Protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ bool Game::loadGameFromJson(std::string jsonStr)
persons[i].friendship = j["persons"][i]["friendship"];
persons[i].isHint = j["persons"][i]["isHint"];
}
friendship_noncard_yayoi = j["persons"][PSID_noncardYayoi]["friendship"];
friendship_noncard_reporter = j["persons"][PSID_noncardReporter]["friendship"];
friendship_noncard_yayoi = j["friendship_noncard_yayoi"];
friendship_noncard_reporter = j["friendship_noncard_reporter"];

for (int i = 0; i < 5; i++) {
for (int p = 0; p < 5; p++) {
Expand All @@ -87,7 +87,7 @@ bool Game::loadGameFromJson(std::string jsonStr)
else if (pid >= 1000) {
personDistribution[i][p] = PSID_npc;
}
else if (pid >= 0 && pid < 6)
else if (pid >= 0 && pid < 9)
{
personDistribution[i][p] = pid;
}
Expand Down Expand Up @@ -182,8 +182,13 @@ bool Game::loadGameFromJson(std::string jsonStr)
for (int i = 0; i < 8; i++) {
cook_train_material_type[i] = j["cook_train_material_type"][i];
cook_train_green[i] = j["cook_train_green"][i];
if (cook_train_material_type[i] == -1)
cook_train_material_type[i] = i < 5 ? i : 0;//凯斯连战休息,以及锁比赛回合可能返回-1,这里设成萝卜,避免闪退
}

cook_main_race_material_type = j.contains("cook_main_race_material_type") ? int(j["cook_main_race_material_type"]) : -1;
if (isRacing && cook_main_race_material_type == -1)//凯斯特殊回合
cook_main_race_material_type = 0;

if (friend_type != 0) {
friend_outgoingUsed = j["friend_outgoingUsed"];
Expand Down
8 changes: 4 additions & 4 deletions UmaSimulator/GameDatabase/GameConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using namespace std;
using json = nlohmann::json;

double GameConfig::radicalFactor = 5;
int GameConfig::eventStrength = 20;
double GameConfig::radicalFactor = 3;
int GameConfig::eventStrength = GameConstants::EventStrengthDefault;

#if USE_BACKEND != BACKEND_NONE //神经网络版
#if USE_BACKEND == BACKEND_LIBTORCH //神经网络版
Expand All @@ -28,10 +28,10 @@ int GameConfig::batchSize = 1;
int GameConfig::searchSingleMax = 4096;
int GameConfig::searchTotalMax = 0;
int GameConfig::searchGroupSize = 128;
int GameConfig::maxDepth = TOTAL_TURN;
int GameConfig::maxDepth = 2 * TOTAL_TURN;
#endif

double GameConfig::searchCpuct = 1.0;
double GameConfig::searchCpuct = 4.0;

string GameConfig::communicationMode = "localfile";
string GameConfig::role = "default";
Expand Down
10 changes: 5 additions & 5 deletions UmaSimulator/GameDatabase/GameConstants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

//常数或者比较短的列表放在最前面
const double GameConstants::ScorePtRateDefault = 2.0;
const double GameConstants::HintLevelPtRateDefault = 7.0;//以前默认5,种菜杯的hint经常稀缺,就增加到7
const double GameConstants::HintLevelPtRateDefault = 8.0;//以前默认5,种菜杯的hint经常稀缺,就增加到8
//const double GameConstants::ScorePtRateQieZhe = 2.2;
const int GameConstants::BasicFiveStatusLimit[5] = { 2300,1000,2200,2200,1500 }; //游戏里原来是1750 1000 1700 1700 1350,模拟器中1200以上翻倍

Expand Down Expand Up @@ -133,7 +133,7 @@ const int GameConstants::TrainingBasicValue[5][5][7] =
{
{ 11, 0, 2, 0, 0, 5, -19},
{ 12, 0, 2, 0, 0, 5, -21},
{ 13, 0, 3, 0, 0, 5, -22},
{ 13, 0, 2, 0, 0, 5, -22},
{ 14, 0, 3, 0, 0, 5, -24},
{ 15, 0, 4, 0, 0, 5, -25},
},
Expand All @@ -149,7 +149,7 @@ const int GameConstants::TrainingBasicValue[5][5][7] =
{
{ 0, 4, 9, 0, 0, 5, -20},
{ 0, 4, 10, 0, 0, 5, -22},
{ 0, 5, 11, 0, 0, 5, -23},
{ 0, 4, 11, 0, 0, 5, -23},
{ 0, 5, 12, 0, 0, 5, -25},
{ 0, 6, 13, 0, 0, 5, -26},
},
Expand All @@ -158,14 +158,14 @@ const int GameConstants::TrainingBasicValue[5][5][7] =
{ 2, 0, 2, 10, 0, 5, -20},
{ 2, 0, 2, 11, 0, 5, -22},
{ 2, 0, 2, 12, 0, 5, -23},
{ 2, 0, 2, 13, 0, 5, -25},
{ 3, 0, 3, 13, 0, 5, -25},
{ 3, 0, 3, 14, 0, 5, -26},
},
//
{
{ 2, 0, 0, 0, 8, 5, 5},
{ 2, 0, 0, 0, 9, 5, 5},
{ 3, 0, 0, 0, 10, 5, 5},
{ 2, 0, 0, 0, 10, 5, 5},
{ 3, 0, 0, 0, 11, 5, 5},
{ 4, 0, 0, 0, 12, 5, 5},
},
Expand Down
Loading

0 comments on commit ca88122

Please sign in to comment.