NOTES I refer to the roles Engineer, Doctor, GA, Guard, and Crew as the good roles. I refer to the roles AC Follower, Gnosia, and Bug as the evil roles. When I make reference to whether a character logically could be a role, or must not be a role, or the odds that they are a role, I mean using the relevant game logic tables. Internally, the game separates the state of the Definite Human skill into two categories based on whether the target could be the AC Follower or cannot be the AC Follower. I refer to targets that cannot be AC Follower as Def Crew, and targets that could be AC Follower as Def Human. When I say Def Crew/Human, I mean Def Crew or Def Human. Revealed Guards are always considered to be Def Crew. Internally, stat values are recorded as numbers between 0 and 1, where 1 is equivalent to the max stat value of 50. Whenever stat values are used here, I have already accounted for this by adding a 0.02 facor, so you should use the normal stat values in the range 0 to 50. The 6 Gnosia personality attributes are Playful, Social, Logic, Neat, Desire, and Courage. I refer to the Logic personality attribute as Smart instead to differentiate it from the Logic stat which is completely different. From now on, whenever I say Logic, I mean the Logic stat and not the Smart personality attribute. All NPC personality are fixed and never change. You can find a reference for their values here: https://www.reddit.com/r/Gnosia_/comments/v20o0o/character_attributes/ When I refer to a reverse personality attribute, I mean the value of that attribute when subtracted from 1. For example, if a character's Courage is 0.75, their reverseCourage is 0.25. When I say that a number x scales with Smart[y], it means that the final value only reaches x when Smart is 1. Otherwise, (1-Smart)*y*x is lost from the value of x. For example, say a number increases by 5, scaled with Smart[0.50] and reverseCourage[0.30]. That means that 0.50*5 = 2.5 of the total value is dependent on how high Smart is. If Smart is actually 0.4 then only 0.4*2.5 = 1 is gained instead of the full 2.5. Similarly, it means that 0.30*5 = 1.5 of the total value is dependent on how high reverseCourage is. If Courage is 0.4, then reverseCourage is 0.6, and then only 0.6*1.5 = 0.9 is gained instead of the full 1.5. Because the scalings indicated for Smart and reverseCourage do not total to 1, that indicates that there is a portion of the gain that is fixed. In this case, that is 1-0.50-0.30 = 0.20. Since 0.20*5 = 1, that means there is a fixed gain of 1 regardless of the values of Smart and Courage. So an increase of 5, scaled with Smart[0.50] and reverseCourage[0.30], becomes an actual increase of 1 + 0.9 + 1 = 2.9 when Smart=0.4 and Courage = 0.4. Starting a Small Talk influences all living Gnosia, unless a Gnosia interrupts the Small Talk in which case only the interrupter is not influenced. Characters that join a Small Talk started by another character do not influence the Gnosia; only the starter gains that benefit. Gnosia NPCs reset their Small Talk influence at the start of each day. === For each living Gnosia i For each livng non-Gnosia j If j is not Def Crew/Human and not a valid Def Crew target and doesn't have to be good for i to be good Let num7 be the j with the lowest average public trust among all such j Let num8 be num7's average public trust For each living non-Gnosia k Let num9 be how much i wants to hit k, initialize num9 to a random number in the range 0 to 0.25 Increase num9 by i's inner trust of k, scaled by i's Smart[0.50] Increase num9 by k's average public trust, scaled by i's Social[0.50] Decrease num9 by i's friendship with k, scaled by i's Neat[1.00] If i and k are collaborators and its logically possible they could both be good Decrease num9 by 0.5 Decrease num9 by 1, scaled by i's Neat[0.60] and i's reverseSmart[0.40] If the Gnosia are more than one kill away from winning If k's public trust of i is above 0.55 Decrease num9 by 2.22 times the amount over 0.55, scaled by i's Social[1.00] If k claims Engineer If k could be the real Engineer and its certain there is no GA alive Increase num9 by 1.5 times the odds k is the real Engineer, scaled by i's Desire[0.40] and i's reverseCourage[0.20] and i's Smart[0.40] If k is Def Crew, increase num9 by 6 Increase num9 by 2 times the odds k is the real Engineer, scaled by i's reversePlayful[0.30] and i's reverseCourage[0.20] and i's Smart[0.50] If k is Def Crew, increase num9 by 1 If k claims Doctor If k could be the real Doctor and its certain there is no GA alive Increase num9 by the odds k is the real Doctor, scaled by i's Desire[0.40] and i's reverseCourage[0.20] and i's Smart[0.40] If k is Def Crew, increase num9 by 3 Increase num9 by the odds k is the real Doctor, scaled by i's reversePlayful[0.30] and i's reverseCourage[0.20] and i's Smart[0.50] If k is Def Crew, increase num9 by 0.7 If k is Def Crew/Human Increase num9 by 0.25 Increase num9 by 1, scaled by i's Smart[0.50] and i's Desire[0.50] Else If k is a valid Def Crew target and has claimed Engineer or Doctor Increase num9 by 0.25 Increase num9 by 0.5, scaled by i's Smart[0.60] and i's reverseCourage[0.40] Else If k logically must be AC Follower Decrease num9 by 0.5, scaled by i's Neat[1.00] If (k has fake claimed and they are the only claimant of their role alive) or (the Gnosia are two kills away from winning) Decrease num9 by 0.5, scaled by i's Smart[1.00] If k has claimed Engineer, Doctor, or Guard Multiply num9 by (1 - ((0.02 * i's Logic) * i's Smart)) If k is num7 and i's Logic is 15 or higher Decrease num9 by (0.06 * i's Logic) If k is Def Enemy Decrease num9 by 1.25, scaled by i's Smart[0.50] and i's Desire[0.50] Else If k is a valid Def Enemy target Decrease num9 by 1, scaled by i's Smart[0.50] and i's reversePlayful[0.50] If i has a collaborator, and i and their collaborator could logically both be good, and k logically must be Gnosia from the perspective of i's collaborator Decrease num9 by 0.5 Decrease num9 by 1, scaled by i's Neat[0.60] and i's reverseSmart[0.40] // END If the Gnosia are more than one kill away from winning For each time that Gnosia have tried to hit k before and failed If the odds that k is Bug are below 0.5 If i's Smart is below 0.45, or its logically possible for k to be Bug, or the Gnosia are one kill away from winning Decrease num9 by 1 Decrease num9 by 4, scaled by i's reverseCourage[1.00] Else Decrease num9 by 0.25 Decrease num9 by 0.5, scaled by i's reverseCourage[1.00] Else Decrease num9 by 1.25 Decrease num9 by 1.25, scaled by i's Smart[1.00] If the Gnosia are more than one kill away from winning (yes, this is the same condition again) For each Engineer report that said k was Gnosia If i was the one who made the report Decrease num9 by 5 If another Gnosia made the report Decrease num9 by 1 Decrease num9 by (0.5 + 0.5 * (i's friendship with the reporter)), scaled by i's Neat[1.00] Decrease num9 by the average public trust of the reporter, scaled by i's Desire[1.00] Let num10 be a measure of how logically bad it would be to kill k Initialize num10 to "Killing k causes no problems" Clear flag5 Let x be 0.2 + (0.04 * (i's Logic) * ((i's reverseCourage)+ (i's Smart))) With random chance x, do the following Create a copy of the game logic table and add the knowledge that k is not Gnosia and not Bug to it Check the copied logic tables for relevant problems Set num10 to the result of this check Else If there is only one Gnosia alive Set flag5 Create a copy of the game logic table and add the knowledge that k is not Gnosia and not Bug to it Check the copied logic tables for relevant problems Set num10 to the result of this check If num10 says "Killing k would directly expose i" Set num9 to 0 Else If num10 says "Killing k would directly expose a Gnosia" and its logically possible that k is good Decrease num9 by 5, scaled by i's reverseDesire[0.30], i's Neat[0.45], and i's reversePlayful[0.25] Decrease num9 by 5, scaled by the average public trust of k Else If num10 says "Killing k would directly expose a Gnosia or indirectly expose i" and flag5 isn't set Set num9 to 0 Else if num10 says "Killing k would expose i's collaborator" and flag5 isn't set Decrease num9 by 5, scaled by i's reverseDesire[0.30], i's Neat[0.45], and i's reversePlayful[0.25] Decrease num9 by 5, scaled by the average public trust of k // END If the Gnosia are more than one kill away from winning (again) If the Gnosia are one kill away from winning Increase num9 by 2 times the odds that k is the GA, scaled by i's Smart[1.00] Decrease num9 by the odds that k is the AC Follower, scaled by i's Neat[1.00] Let y be 0.5 + 0.01*(k's Stealth - i's Intuition)/(0.05 + 0.004*(k's Stealth)) Bound y in the range 0 to 1 //NOTES: When k's Stealth is equal to i's Intuition, y is 0.5 //NOTES: As k's Stealth goes higher than i's Intuition, y quickly approaches 1 //NOTES: As k's Stealth goes lower than i's Intuition, y quickly approaches 0 Multiply num9 by 0.4 + (0.6 * (1 - y) * (k's hate)) If k logically must be the Bug, set num9 to 0 If the scenario where we want to search the hangar is active, and i is Setsu, and k is Jonas If Gnosia have failed a hit on Jonas before Multiply num9 by 2.5 Else Multiply num9 by 1000 If Gnosia i has their buf13 flag set for char k Add the hit action {i hits k, weight: 0.0001} to list3 //NOTES: list3 is the lowest priority hit list //NOTES: the buf13 flag is set by a few story scenarios to stop certain characters from hitting certain other characters Else If num9 is 0.0001 or lower Add the hit action {i hits k, weight: 0.0001} to list2 //NOTES: list2 is the second lowest priority hist list Else If k is the Player Multiply num9 by 0.7 If its Day 1 Multiply num9 by 0.25 Multiply num9 by 25 + (1.5 * (i's charisma)) //NOTES: This results in high charisma Gnosia being more likely to make the hit Add the hit action {i hits k, weight: num9} to list //NOTES: list is the main, highest priority hit list //END For each living non-Gnosia k If i added at least 2 targets to the main list and the GA may be alive and the Gnosia are more than one kill away from winning Let num11 be the weight of i's highest weight target divided by the weight of i's second highest weight target If num11 is at least 1.5 and i's Smart is at least 0.45 Let num12 be the odds that the GA is alive but not i's highest weight target Multiply num12 by 1, scaled by i's reverseCourage[0.30] and i's Smart[0.20] With random chance num12, do the following Let num11 be the weight of i's highest weight target minus the weight of i's second highest weight target If the Gnosia have failed a hit on i's highest weight target before Multiply num11 by (0.5 + 0.3*(i's reverseCourage) + (random number in range 0 to 0.8)) Else Multiply num11 by (0.5 + 0.3*(i's reverseCourage) + (random number in range 0 to 0.4)) If i's second highest weight target was the Player Multiply num11 by 0.7 If its Day 1 Multiply num11 by 0.25 Increase the weight of i's second higest weight target in list by num11 //END If i added at least 2 targets to the main list and the GA may be alive and the Gnosia are more than one kill away from winning //END For each living Gnosia i If list is empty If list2 is empty Add the contents of list3 to list Else Add the contents of list2 to list Randomly select a hit action {i hits k} from list, using weighted random selection If i has been influenced by k's Small Talk, or the scenario The Return Of The Saint is active and k is Setsu Reroll the hit action {i hits k} from list, using weighted random selection //NOTES: The hit action can only be rerolled once, and could reroll to the exact same hit Submit final hit action as Gnosia i hits target k