public static void waterCropSpell(Spell s) { // if (Class1.mouseAction == true) return; //necessary for non repeating functions/spells const int baseCost = 5; //calculate all costs then factor in player proficiency int cost = (int)(((((baseCost) + s.spellCostModifierInt) * s.spellCostModifierPercent) * (1f - PlayerVariables.MagicProficiency)) - PlayerVariables.MagicLevel); //+s.extraCostInt-s.spellSaveInt * (1f- PlayerVariables.MagicProficiency) / s.extraCostPercent* s.spellSavePercent; if (Game1.player.currentLocation.isCropAtTile((int)Game1.currentCursorTile.X, (int)Game1.currentCursorTile.Y)) { try { TerrainFeature t; bool f = Game1.currentLocation.terrainFeatures.TryGetValue(Game1.currentCursorTile, out t); if ((t as HoeDirt).state == 0) { (t as HoeDirt).state = 1; Game1.playSound("slosh"); DelayedAction.playSoundAfterDelay("glug", 250); MagicMonitor.consumeMagic(cost); MagicMonitor.consumeUsage(s); } } catch (Exception e) { //Log.AsyncR("BAD Water SPELL"); } } else { //Log.AsyncC(Game1.currentCursorTile); //Log.AsyncC("Cant water here "); } }
public static void cropGrowthSpell(Spell s) { if (Class1.mouseAction == true) { return; //necessary for non repeating functions/spells } const int baseCost = 50; //calculate all costs then factor in player proficiency int cost = (int)(((((baseCost) + s.spellCostModifierInt) * s.spellCostModifierPercent) * (1f - PlayerVariables.MagicProficiency)) - PlayerVariables.MagicLevel); //+s.extraCostInt-s.spellSaveInt * (1f- PlayerVariables.MagicProficiency) / s.extraCostPercent* s.spellSavePercent; if (Game1.player.currentLocation.isCropAtTile((int)Game1.currentCursorTile.X, (int)Game1.currentCursorTile.Y)) { try { TerrainFeature t; bool f = Game1.currentLocation.terrainFeatures.TryGetValue(Game1.currentCursorTile, out t); (t as HoeDirt).crop.dayOfCurrentPhase++; if ((t as HoeDirt).crop.dayOfCurrentPhase >= (t as HoeDirt).crop.phaseDays[(t as HoeDirt).crop.currentPhase]) { (t as HoeDirt).crop.currentPhase++; (t as HoeDirt).crop.dayOfCurrentPhase = 0; } MagicMonitor.consumeMagic(cost); MagicMonitor.consumeUsage(s); } catch (Exception e) { } } else { } }
public static void warpHome(Spell s) { const int baseCost = 5; //calculate all costs then factor in player proficiency int cost = (int)(((((baseCost) + s.spellCostModifierInt) * s.spellCostModifierPercent) * (1f - PlayerVariables.MagicProficiency)) - PlayerVariables.MagicLevel); //+s.extraCostInt-s.spellSaveInt * (1f- PlayerVariables.MagicProficiency) / s.extraCostPercent* s.spellSavePercent; for (int i = 0; i < 12; i++) { Game1.player.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(354, (float)Game1.random.Next(25, 75), 6, 1, new Vector2((float)Game1.random.Next((int)Game1.player.position.X - Game1.tileSize * 4, (int)Game1.player.position.X + Game1.tileSize * 3), (float)Game1.random.Next((int)Game1.player.position.Y - Game1.tileSize * 4, (int)Game1.player.position.Y + Game1.tileSize * 3)), false, Game1.random.NextDouble() < 0.5)); } Game1.playSound("wand"); int num = 0; for (int j = Game1.player.getTileX() + 8; j >= Game1.player.getTileX() - 8; j--) { Game1.player.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(6, new Vector2((float)j, (float)Game1.player.getTileY()) * (float)Game1.tileSize, Color.White, 8, false, 50f, 0, -1, -1f, -1, 0) { layerDepth = 1f, delayBeforeAnimationStart = num * 25, motion = new Vector2(-0.25f, 0f) }); num++; } Game1.warpFarmer("Farm", 64, 16, false); MagicMonitor.consumeMagic(cost); MagicMonitor.consumeUsage(s); }
public static void showRedMessage(Spell s) { if (Class1.mouseAction == true) { return; //necessary for non repeating functions/spells } const int baseCost = 5; //calculate all costs then factor in player proficiency int cost = (int)(((((baseCost) + s.spellCostModifierInt) * s.spellCostModifierPercent) * (1f - PlayerVariables.MagicProficiency)) - PlayerVariables.MagicLevel); //+s.extraCostInt-s.spellSaveInt * (1f- PlayerVariables.MagicProficiency) / s.extraCostPercent* s.spellSavePercent; Game1.showRedMessage("MAGIC WORKS"); MagicMonitor.consumeMagic(cost); MagicMonitor.consumeUsage(s); }
public static void warpHorse(Spell s) { NPC horse = Utility.findHorse(); if (horse == null) { return; } const int baseCost = 20; //calculate all costs then factor in player proficiency int cost = (int)(((((baseCost) + s.spellCostModifierInt) * s.spellCostModifierPercent) * (1f - PlayerVariables.MagicProficiency)) - PlayerVariables.MagicLevel); //+s.extraCostInt-s.spellSaveInt * (1f- PlayerVariables.MagicProficiency) / s.extraCostPercent* s.spellSavePercent; MagicMonitor.consumeMagic(cost); MagicMonitor.consumeUsage(s); Game1.warpCharacter(horse, Game1.player.currentLocation.name, Game1.player.getTileLocationPoint(), false, true); }
/// <summary> /// Restore 100% of stamina. /// </summary> /// <param name="s"></param> public static void revitalize(Spell s) { if (Game1.player.stamina >= Game1.player.maxStamina) { return; } const int baseCost = 100; int healAmount = (int)(Game1.player.maxStamina * 1f); //calculate all costs then factor in player proficiency int cost = (int)(((((baseCost) + s.spellCostModifierInt) * s.spellCostModifierPercent) * (1f - PlayerVariables.MagicProficiency)) - PlayerVariables.MagicLevel); //+s.extraCostInt-s.spellSaveInt * (1f- PlayerVariables.MagicProficiency) / s.extraCostPercent* s.spellSavePercent; Game1.player.stamina += healAmount; MagicMonitor.consumeMagic(cost); MagicMonitor.consumeUsage(s); }
public static void rainyWeather(Spell s) { const int baseCost = 35; //calculate all costs then factor in player proficiency int cost = (int)(((((baseCost) + s.spellCostModifierInt) * s.spellCostModifierPercent) * (1f - PlayerVariables.MagicProficiency)) - PlayerVariables.MagicLevel); //+s.extraCostInt-s.spellSaveInt * (1f- PlayerVariables.MagicProficiency) / s.extraCostPercent* s.spellSavePercent; if (Game1.weatherForTomorrow != Game1.weather_rain) { Game1.weatherForTomorrow = Game1.weather_rain; MagicMonitor.consumeMagic(cost); MagicMonitor.consumeUsage(s); } else { Game1.showGlobalMessage("It's already going to be rainy tomorrow."); } }