/** * Called whenever the player makes a sacrifice to the gods: this god will then decide how it wants to react * to this type of sacrifice, based on their preferences */ public void SacrificeMade(string sacrificeItemName) { // Get the actual item being sacrificed, we need it's use function CraftingItem sacrificeItem = WorldManager.instance.GetCraftingItemByName(sacrificeItemName); if (sacrificeItem == null) { Debug.Log("WARNING! Diety::SacrificeMade() Could not find the CraftingItem with the name: " + sacrificeItemName); return; } // Perfrom the function of the crafting item sacrificeItem.ActivateUse(WorldManager.instance.GetActivePlayer()); // Adjust the gods feelings towards the player based on the item sacrifised and its preferences float prefVal = GetValueForItem(sacrificeItemName); float prefMag = Mathf.Abs(prefVal); float prefSign = Mathf.Sign(prefVal); // The dieties relation to the player will react more at the smaller ends of the spectrum float deltaRelation = 0.0f; // the larger the magnitude of the relation, the smaller the change will be so that a larger relation is harder to change float reactionMag = 1.0f - Mathf.Abs(playerRelation); float maxDeltaReaction = prefMag * GLOBAL_MAX_DELTA_REACTION; deltaRelation = (maxDeltaReaction * reactionMag) * prefSign; playerRelation += deltaRelation; Debug.Log(sacrificeItemName + " for " + dietyName + " :: " + playerRelation + " --- Delta = " + deltaRelation); }