private static bool CalculateEnemyPacification(PlayerEntity player, DFCareer.Skills languageSkill) { double chance = 0; if (languageSkill == DFCareer.Skills.Etiquette || languageSkill == DFCareer.Skills.Streetwise) { chance += player.Skills.GetLiveSkillValue(languageSkill) - 20; chance += (player.Stats.LivePersonality - 55) / 3; chance += (player.Stats.LiveIntelligence - 55) / 3; } else { chance += player.Skills.GetLiveSkillValue(languageSkill); chance += (player.Stats.LivePersonality - 50) / 5; } chance += GameManager.Instance.WeaponManager.Sheathed ? 10 : -25; chance += (player.Stats.LiveLuck - 50) / 5; // Add chance from Comprehend Languages effect if present ComprehendLanguages languagesEffect = (ComprehendLanguages)GameManager.Instance.PlayerEffectManager.FindIncumbentEffect <ComprehendLanguages>(); if (languagesEffect != null) { chance += languagesEffect.ChanceValue(); } int roll = UnityEngine.Random.Range(0, 130); bool success = (roll < chance); #if UNITY_EDITOR Debug.LogFormat("Archaeologists Pacification {3} using {0} skill: chance= {1} roll= {2}", languageSkill, chance, roll, success ? "success" : "failure"); #endif return(success); }
private static bool CalculateEnemyPacification(PlayerEntity player, DFCareer.Skills languageSkill) { double chance = 0; if (languageSkill == DFCareer.Skills.Etiquette || languageSkill == DFCareer.Skills.Streetwise) { chance += player.Skills.GetLiveSkillValue(languageSkill) / 2; chance += player.Stats.LivePersonality / 2; } else { chance += player.Skills.GetLiveSkillValue(languageSkill); chance += (player.Stats.LivePersonality - 50) / 5; } chance += GameManager.Instance.WeaponManager.Sheathed ? 10 : -25; chance += (player.Stats.LiveLuck - 50) / 5; // Add chance from Comprehend Languages effect if present ComprehendLanguages languagesEffect = (ComprehendLanguages)GameManager.Instance.PlayerEffectManager.FindIncumbentEffect <ComprehendLanguages>(); if (languagesEffect != null) { chance += languagesEffect.ChanceValue(); } int roll = UnityEngine.Random.Range(0, 130); bool success = (roll < chance); /* * if (success) * player.TallySkill(languageSkill, 3); // Increased skill uses from (assumed) 1 in classic on success to make raising language skills easier * else if (languageSkill != DFCareer.Skills.Etiquette && languageSkill != DFCareer.Skills.Streetwise) * player.TallySkill(languageSkill, 1); */ Debug.LogFormat("Archaeologists Pacification {3} using {0} skill: chance= {1} roll= {2}", languageSkill, chance, roll, success ? "success" : "failure"); return(success); }