WIP: char stat adjusted skeleton actions
This commit is contained in:
		
							parent
							
								
									a86525324e
								
							
						
					
					
						commit
						6df8cb461c
					
				
							
								
								
									
										17
									
								
								bonemarketsolver/challenge_functions.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								bonemarketsolver/challenge_functions.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| def narrow_challenge(difficulty_level: int, stat: int): | ||||
|     offset = 6 - difficulty_level | ||||
|     stat += offset | ||||
| 
 | ||||
|     if stat > 9: | ||||
|         return 1 | ||||
|     elif stat < 2: | ||||
|         return .1 | ||||
|     else: | ||||
|         return stat/10 | ||||
| 
 | ||||
| def mean_outcome(success: int, failure: int, chance: float): | ||||
|     mean_success = success*chance | ||||
|     mean_failure = failure*(1-chance) | ||||
|     combined_mean_outcome = mean_success + mean_failure | ||||
| 
 | ||||
|     return combined_mean_outcome | ||||
| @ -5,26 +5,53 @@ from enum import Enum | ||||
| 
 | ||||
| from .costs import Cost | ||||
| from ..objects.action import Action | ||||
| from ..read_char import * | ||||
| 
 | ||||
| 
 | ||||
| def _narrow_challenge_6(stat: int): | ||||
|     if 0 < stat < 11: | ||||
|         chance = stat/10 | ||||
|     elif stat < 1: | ||||
|         chance = .1 | ||||
|     else: | ||||
|         chance = 1 | ||||
| 
 | ||||
|     return chance | ||||
| 
 | ||||
| 
 | ||||
| def _implausibility(stat: int): | ||||
|     chance = _narrow_challenge_6(stat) | ||||
| 
 | ||||
|     if chance == 1: | ||||
|         return 0 | ||||
|     else: | ||||
|         failure_actions = (1 / chance) - 1 | ||||
|         implausibility = 2 * failure_actions | ||||
|         return implausibility | ||||
| 
 | ||||
| 
 | ||||
| class Adjustment(Enum): | ||||
|     """An action that is taken after all parts have been added to a skeleton.""" | ||||
| 
 | ||||
|     CARVE_AWAY_AGE = Action( | ||||
|             "Carve away some evidence of age", | ||||
|             cost = Cost.ACTION.value, | ||||
|             antiquity = -2 | ||||
|             cost = Cost.ACTION.value / _narrow_challenge_6(Char.MITHRIDACY.value), | ||||
|             antiquity = -2, | ||||
|             implausibility = _implausibility(Char.MITHRIDACY.value) | ||||
|             ) | ||||
| 
 | ||||
|     DISGUISE_AMALGAMY = Action( | ||||
|             "Disguise the amalgamy of this piece", | ||||
|             cost = Cost.ACTION.value + 25*Cost.JADE_FRAGMENT.value, | ||||
|             amalgamy = -2 | ||||
|             cost = 25*Cost.JADE_FRAGMENT.value + Cost.ACTION.value / _narrow_challenge_6(Char.KATALEPTIC_TOXICOLOGY.value), | ||||
|             amalgamy = -2, | ||||
|             implausibility = _implausibility(Char.KATALEPTIC_TOXICOLOGY.value) | ||||
|             ) | ||||
| 
 | ||||
|     MAKE_LESS_DREADFUL = Action( | ||||
|             "Make your skeleton less dreadful", | ||||
|             cost = Cost.ACTION.value, | ||||
|             menace = -2 | ||||
|             cost = Cost.ACTION.value / _narrow_challenge_6(Char.KATALEPTIC_TOXICOLOGY.value), | ||||
|             menace = -2, | ||||
|             implausibility = _implausibility(Char.KATALEPTIC_TOXICOLOGY.value) | ||||
|             ) | ||||
| 
 | ||||
|     def __str__(self): | ||||
|  | ||||
| @ -5,6 +5,9 @@ from enum import Enum | ||||
| 
 | ||||
| from .costs import Cost | ||||
| from ..objects.action import Action | ||||
| from ..read_char import * | ||||
| from ..challenge_functions import narrow_challenge, mean_outcome | ||||
| 
 | ||||
| 
 | ||||
| class Appendage(Enum): | ||||
|     """An action that is taken once all skulls are added to a skeleton.""" | ||||
| @ -17,6 +20,7 @@ class Appendage(Enum): | ||||
|             amalgamy = 2 | ||||
|             ) | ||||
| 
 | ||||
|     # TODO: Difficulty is increased by 2 for each Fin or Tentacle on the skeleton | ||||
|     ALBATROSS_WING = Action( | ||||
|             "Put an Albatross Wing on your (Skeleton Type)", | ||||
|             cost = Cost.ACTION.value + Cost.ALBATROSS_WING.value, | ||||
| @ -26,6 +30,7 @@ class Appendage(Enum): | ||||
|             amalgamy = 1 | ||||
|             ) | ||||
| 
 | ||||
|     # TODO: Difficulty is increased by 2 for each Arm, Leg, Wing, and Tentacle that is already attached | ||||
|     AMBER_FIN = Action( | ||||
|             "Attach the Amber-Crusted Fin to your (Skeleton Type)", | ||||
|             cost = Cost.ACTION.value + Cost.AMBER_FIN.value, | ||||
| @ -36,6 +41,7 @@ class Appendage(Enum): | ||||
|             menace = 1 | ||||
|             ) | ||||
| 
 | ||||
|     # TODO: Difficulty is increased with Fins on the skeleton | ||||
|     BAT_WING = Action( | ||||
|             "Add a Bat Wing to your (Skeleton Type)", | ||||
|             cost = Cost.ACTION.value + Cost.BAT_WING.value, | ||||
| @ -51,7 +57,7 @@ class Appendage(Enum): | ||||
|             value = 50, | ||||
|             tails_needed = -1, | ||||
|             tails = 1, | ||||
|             menace = 2 | ||||
|             menace = mean_outcome(2, 1, narrow_challenge(4, Char.MONSTROUS_ANATOMY.value)) | ||||
|             ) | ||||
| 
 | ||||
|     CRUSTACEAN_PINCER = Action( | ||||
| @ -80,6 +86,8 @@ class Appendage(Enum): | ||||
|             legs = 1 | ||||
|             ) | ||||
| 
 | ||||
|     # TODO: Base challenge: Narrow, Monstrous Anatomy 1 | ||||
|     #       The difficulty is increased by 2 for each Arm, Leg, Wing, and Tentacle already attached to your skeleton. | ||||
|     FIN_BONES = Action( | ||||
|             "Put Fins on your (Skeleton Type)", | ||||
|             cost = Cost.ACTION.value + Cost.FIN_BONES.value, | ||||
| @ -94,7 +102,7 @@ class Appendage(Enum): | ||||
|             value = 2750, | ||||
|             limbs_needed = -1, | ||||
|             arms = 1, | ||||
|             antiquity = 2 | ||||
|             antiquity = mean_outcome(2, 1, narrow_challenge(11, Char.MONSTROUS_ANATOMY.value)) | ||||
|             ) | ||||
| 
 | ||||
|     HELICAL_THIGH = Action( | ||||
| @ -103,7 +111,7 @@ class Appendage(Enum): | ||||
|             value = 300, | ||||
|             limbs_needed = -1, | ||||
|             legs = 1, | ||||
|             amalgamy = 2 | ||||
|             amalgamy = mean_outcome(2, 1, narrow_challenge(6, Char.SHAPELING_ARTS.value)) | ||||
|             ) | ||||
| 
 | ||||
|     HUMAN_ARM = Action( | ||||
|  | ||||
| @ -5,6 +5,21 @@ from enum import Enum | ||||
| 
 | ||||
| from .costs import Cost | ||||
| from ..objects.action import Action | ||||
| from ..read_char import * | ||||
| from ..challenge_functions import narrow_challenge | ||||
| 
 | ||||
| 
 | ||||
| def _convincing_history_cost(): | ||||
|     chance = narrow_challenge(6, Char.KATALEPTIC_TOXICOLOGY.value) | ||||
| 
 | ||||
|     if chance == 1: | ||||
|         cost = 3*Cost.REVISIONIST_NARRATIVE.value + Cost.ACTION.value | ||||
|     else: | ||||
|         actions = 1 / chance | ||||
|         cost = actions * Cost.ACTION.value | ||||
|         cost += Cost.REVISIONIST_NARRATIVE.value * (3 + actions - 1) | ||||
|     return cost | ||||
| 
 | ||||
| 
 | ||||
| class Embellishment(Enum): | ||||
|     """An action is taken after a declaration has been made for a skeleton.""" | ||||
| @ -17,7 +32,7 @@ class Embellishment(Enum): | ||||
| 
 | ||||
|     CONVINCING_HISTORY = Action( | ||||
|             "Invest great time and skill in coming up with a convincing history", | ||||
|             cost = Cost.ACTION.value + 3*Cost.REVISIONIST_NARRATIVE.value, | ||||
|             cost = _convincing_history_cost(), | ||||
|             implausibility = -5 | ||||
|             ) | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user