public static float GetWaterTerrainScore(Pawn eater, IntVec3 c, float dist, bool priorQuality) { TerrainDef terrain = c.GetTerrain(eater.Map); // 水源ではない or 水源として使えない if (!terrain.IsWater()) { return(float.MinValue); } var waterTypeDef = MizuDef.Dic_WaterTypeDef[terrain.ToWaterType()]; // 基本点計算 // 距離 float distScore = -dist; // 心情変化量(水質) // メモ // きれい= +10 // 普通 = 0 // 生水 = 0 // 泥水 = -6 // 海水 = -6 float thoughtScore = 0f; // 禁欲の影響も含まれている List <ThoughtDef> thoughtList = new List <ThoughtDef>(); MizuUtility.ThoughtsFromWaterTypeDef(eater, waterTypeDef, true, thoughtList); foreach (var thought in thoughtList) { thoughtScore += thought.stages[0].baseMoodEffect; } // 食中毒 // メモ // きれい= 0 => 0 // 普通 = 0 => 0 // 生水 = 0.01 => -10 // 泥水 = 0.03 => -30 // 海水 = 0.03 => -30 float foodPoisoningScore = -(waterTypeDef.foodPoisonChance * 1000f); // 健康悪化 float hediffScore = 0f; if (waterTypeDef.hediffs != null) { foreach (var hediff in waterTypeDef.hediffs) { hediffScore -= 100f; } } // 基本点合計メモ // 心情,食中毒,健康,合計(禁欲) // きれい= +10, 0, 0, +10( 0) // 普通 = 0, 0, 0, 0( 0) // 生水 = 0, -10, 0, -10( -10) // 泥水 = -6, -30, 0, -36( -30) // 海水 = -6, -30,-100,-136(-130) // 各種状態によるスコアの変化 // 水質優先モードか否か if (priorQuality) { distScore /= 10f; } return(distScore + thoughtScore + foodPoisoningScore); }