protected override bool TryCastShot() { Pawn pawn = this.CasterPawn; if (pawn != null && !pawn.Downed) { CompAbilityUserMagic comp = pawn.TryGetComp <CompAbilityUserMagic>(); Hediff hd = pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_LightCapacitanceHD); if (comp != null && comp.SoL != null && hd != null) { HediffComp_LightCapacitance hdlc = hd.TryGetComp <HediffComp_LightCapacitance>(); if (hdlc != null) { float val = (comp.SoL.LightEnergy + hdlc.LightEnergy) / 2f; comp.SoL.LightEnergy = val; hdlc.LightEnergy = val; MoteMaker.ThrowLightningGlow(pawn.DrawPos, pawn.Map, 1.2f); MoteMaker.ThrowLightningGlow(comp.SoL.DrawPos, comp.SoL.Map, 1.2f); } } } this.burstShotsLeft = 0; return(false); }
private void Initialize() { caster = this.launcher as Pawn; CompAbilityUserMagic comp = caster.GetComp <CompAbilityUserMagic>(); if (comp != null && comp.MagicData != null) { pwrVal = TM_Calc.GetMagicSkillLevel(caster, comp.MagicData.MagicPowerSkill_Sunfire, "TM_Sunfire", "_pwr", true); verVal = TM_Calc.GetMagicSkillLevel(caster, comp.MagicData.MagicPowerSkill_Sunfire, "TM_Sunfire", "_ver", true); } this.arcaneDmg = comp.arcaneDmg; if (caster.health.hediffSet.HasHediff(TorannMagicDefOf.TM_LightCapacitanceHD)) { HediffComp_LightCapacitance hd = caster.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_LightCapacitanceHD).TryGetComp <HediffComp_LightCapacitance>(); this.lightPotency = hd.LightPotency; hd.LightEnergy -= 25f; } int mapTime = GenLocalDate.HourOfDay(caster.Map); if (mapTime > 13) { this.angle = (float)Mathf.Abs(mapTime - 12f) * -5f; } else if (mapTime < 12) { this.angle = (float)Mathf.Abs(12 - mapTime) * 5f; } else { this.angle = 0f; } this.radius += .15f * this.def.projectile.explosionRadius; this.CheckSpawnSustainer(); this.InitializeBeams(); }
private void Initialize() { if (pawn != null) { GetFilteredList(); CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>(); if (comp != null) { pwrVal = comp.MagicData.MagicPowerSkill_LightLance.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_LightLance_pwr").level; verVal = comp.MagicData.MagicPowerSkill_LightLance.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_LightLance_ver").level; this.radius += (verVal * .2f); if (pawn.health.hediffSet.HasHediff(TorannMagicDefOf.TM_LightCapacitanceHD)) { HediffComp_LightCapacitance hd = pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_LightCapacitanceHD).TryGetComp <HediffComp_LightCapacitance>(); this.lightPotency = hd.LightPotency; } } for (int i = 0; i < 3; i++) { Vector3 rndPos = pawn.DrawPos; rndPos.x += Rand.Range(-.75f, .75f); rndPos.z += Rand.Range(-.75f, .75f); MoteMaker.MakeStaticMote(rndPos, pawn.Map, ThingDefOf.Mote_FireGlow, 1f); } } flyingThing.ThingID += Rand.Range(0, 214).ToString(); }
private void Initialize() { caster = this.launcher as Pawn; this.launchPosition = caster.Position; CompAbilityUserMagic comp = caster.GetComp <CompAbilityUserMagic>(); pwrVal = TM_Calc.GetMagicSkillLevel(caster, comp.MagicData.MagicPowerSkill_LightLance, "TM_LightLance", "_pwr", true); verVal = TM_Calc.GetMagicSkillLevel(caster, comp.MagicData.MagicPowerSkill_LightLance, "TM_LightLance", "_ver", true); this.arcaneDmg = comp.arcaneDmg; if (caster.health.hediffSet.HasHediff(TorannMagicDefOf.TM_LightCapacitanceHD)) { HediffComp_LightCapacitance hd = caster.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_LightCapacitanceHD).TryGetComp <HediffComp_LightCapacitance>(); this.lightPotency = hd.LightPotency; } this.radius = Mathf.Clamp(1.8f + (.25f * verVal * lightPotency), 1f, 3f); this.angle = (Quaternion.AngleAxis(90, Vector3.up) * TM_Calc.GetVector(caster.Position, base.Position)).ToAngleFlat(); this.CheckSpawnSustainer(); this.burnTime += pwrVal * 22; lanceAngle = Vector3Utility.FromAngleFlat(this.angle - 90); //angle of beam lanceAngleInv = Vector3Utility.FromAngleFlat(this.angle + 90); //opposite angle of beam drawPosStart = this.launchPosition.ToVector3Shifted() + lanceAngle; //this.parent.DrawPos; drawPosEnd = base.Position.ToVector3Shifted() + lanceAngleInv; lanceLength = (drawPosEnd - drawPosStart).magnitude; lanceVector = drawPosStart + (lanceAngle * lanceLength * 0.5f); lanceVectorInv = drawPosEnd + (lanceAngleInv * lanceLength * .5f); //draw for double beam lanceVector.y = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays); //graphic depth }
private void Initialize() { if (caster != null) { CompAbilityUserMagic comp = caster.GetComp <CompAbilityUserMagic>(); pwrVal = TM_Calc.GetMagicSkillLevel(caster, comp.MagicData.MagicPowerSkill_Refraction, "TM_Refraction", "_pwr", TorannMagicDefOf.TM_Refraction.canCopy); verVal = TM_Calc.GetMagicSkillLevel(caster, comp.MagicData.MagicPowerSkill_Refraction, "TM_Refraction", "_ver", TorannMagicDefOf.TM_Refraction.canCopy); if (caster.health.hediffSet.HasHediff(TorannMagicDefOf.TM_LightCapacitanceHD)) { HediffComp_LightCapacitance hd = caster.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_LightCapacitanceHD).TryGetComp <HediffComp_LightCapacitance>(); this.wallEnergy *= hd.LightPotency; hd.LightEnergy -= 20f; } } }
private void Initialize(Pawn pawn) { CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>(); pwrVal = TM_Calc.GetMagicSkillLevel(pawn, comp.MagicData.MagicPowerSkill_LightBurst, "TM_LightBurst", "_pwr", TorannMagicDefOf.TM_LightBurst.canCopy); verVal = TM_Calc.GetMagicSkillLevel(pawn, comp.MagicData.MagicPowerSkill_LightBurst, "TM_LightBurst", "_ver", TorannMagicDefOf.TM_LightBurst.canCopy); this.burstCount = 2; if (verVal >= 1) { burstCount++; if (verVal >= 3) { burstCount++; } } this.arcaneDmg = comp.arcaneDmg; if (pawn.health.hediffSet.HasHediff(TorannMagicDefOf.TM_LightCapacitanceHD)) { HediffComp_LightCapacitance hd = pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_LightCapacitanceHD).TryGetComp <HediffComp_LightCapacitance>(); this.lightPotency = hd.LightPotency; hd.LightEnergy -= (2.5f * this.burstCount); } }
protected override bool TryCastShot() { int shotCount = 3; if (!base.CasterPawn.DestroyedOrNull()) { CompAbilityUserMagic comp = base.CasterPawn.GetComp <CompAbilityUserMagic>(); if (comp != null) { shotCount -= TM_Calc.GetMagicSkillLevel(base.CasterPawn, comp.MagicData.MagicPowerSkill_LightLance, "TM_LightLance", "_pwr", true); } if (base.CasterPawn.health.hediffSet.HasHediff(TorannMagicDefOf.TM_LightCapacitanceHD)) { HediffComp_LightCapacitance hd = base.CasterPawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_LightCapacitanceHD).TryGetComp <HediffComp_LightCapacitance>(); hd.LightEnergy -= 3f; } } if (this.burstShotsLeft == this.verbProps.burstShotCount) { return(base.TryCastShot()); } else if (this.burstShotsLeft > (0 + shotCount)) { bool outResult = true; PostCastShot(outResult, out outResult); if (!outResult) { Ability.Notify_AbilityFailed(UseAbilityProps.refundsPointsAfterFailing); } return(outResult); } else { return(false); } }
public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth, GizmoRenderParms parms) { if (!pawn.DestroyedOrNull() && !pawn.Dead) { CompAbilityUserMagic compMagic = pawn.GetComp <CompAbilityUserMagic>(); CompAbilityUserMight compMight = pawn.GetComp <CompAbilityUserMight>(); bool isMage = compMagic.IsMagicUser && !pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless); bool isFighter = compMight.IsMightUser; bool isPsionic = pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_PsionicHD"), false); bool isBloodMage = pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_BloodHD"), false); bool isBrightmage = pawn.health.hediffSet.HasHediff(TorannMagicDefOf.TM_LightCapacitanceHD); bool isMonk = pawn.health.hediffSet.HasHediff(TorannMagicDefOf.TM_ChiHD, false); bool isEnchantedItem = this.iComp != null; Hediff hediff = null; for (int h = 0; h < pawn.health.hediffSet.hediffs.Count; h++) { if (pawn.health.hediffSet.hediffs[h].def.defName.Contains("TM_HateHD")) { hediff = pawn.health.hediffSet.hediffs[h]; } } bool isDeathKnight = hediff != null; //bool isLich = pawn.story.traits.HasTrait(TorannMagicDefOf.Lich); float barCount = 0; float boostPsiSev = 100; float boostHateSev = 100; float boostBloodSev = 100; float boostChiSev = 100; if (isFighter) { barCount++; } if (isMage) { barCount++; } if (isPsionic) { barCount++; Hediff hediffBoost = pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_Artifact_PsionicBoostHD); if (hediffBoost != null) { boostPsiSev += hediffBoost.Severity; } } if (isDeathKnight) { barCount++; Hediff hediffBoost = pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_Artifact_HateBoostHD); if (hediffBoost != null) { boostHateSev += hediffBoost.Severity; } } if (isBloodMage) { barCount++; Hediff hediffBoost = pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_Artifact_BloodBoostHD); if (hediffBoost != null) { boostBloodSev += hediffBoost.Severity; } } if (isBrightmage) { barCount++; } if (isMonk) { barCount++; } if (isEnchantedItem) { barCount++; } float barHeight; float initialShift = 0; float barSpacing = 0f; float contractionAmount = 6f; if (barCount == 1) { initialShift = 15f; } else if (barCount >= 2) { initialShift = 5f; barSpacing = 2f; contractionAmount -= barCount; } if (barCount > 0 && ((isFighter && compMight.Stamina != null) || (isMage && compMagic.Mana != null) || (isEnchantedItem && iComp.NecroticEnergy > 0))) { Rect overRect = new Rect(topLeft.x + 2, topLeft.y, this.GetWidth(100), 75); //overall rect size (shell) if (parms.highLight) { QuickSearchWidget.DrawStrongHighlight(overRect.ExpandedBy(12f)); } Find.WindowStack.ImmediateWindow(984698, overRect, WindowLayer.GameUI, delegate { barHeight = (((75 - (2 * contractionAmount)) - (2 * initialShift) - (barSpacing * (barCount - 1))) / (barCount)); Rect rect = overRect.AtZero().ContractedBy(contractionAmount); //inner, smaller rect rect.height = barHeight; Rect rect2 = rect; //label rect, starts at top Text.Font = GameFont.Tiny; float fillPercent = 0; float yShift = initialShift; Text.Anchor = TextAnchor.MiddleCenter; if (isPsionic) { rect2.y = rect.y + yShift; try { fillPercent = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("TM_PsionicHD"), false).Severity / (boostPsiSev); Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullPsionicTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, "" + (pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("TM_PsionicHD"), false).Severity).ToString("F0") + " / " + boostPsiSev.ToString("F0")); } catch { fillPercent = 0f; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullPsionicTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, ""); } yShift += (barHeight) + barSpacing; } if (isDeathKnight) { rect2.y = rect.y + yShift; try { fillPercent = hediff.Severity / boostHateSev; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullDeathKnightTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, "" + hediff.Severity.ToString("F0") + " / " + boostHateSev.ToString("F0")); } catch { fillPercent = 0f; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullDeathKnightTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, ""); } yShift += (barHeight) + barSpacing; } if (isMonk) { rect2.y = rect.y + yShift; try { fillPercent = pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_ChiHD, false).Severity / boostChiSev; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullChiTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, "" + (pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_ChiHD, false).Severity).ToString("F0") + " / " + boostChiSev.ToString("F0")); } catch { fillPercent = 0f; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullChiTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, ""); } yShift += (barHeight) + barSpacing; } if (isFighter) { rect2.y = rect.y + yShift; try { fillPercent = compMight.Stamina.CurInstantLevel / compMight.maxSP; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullStaminaTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, "" + (compMight.Stamina.CurInstantLevel * 100).ToString("F0") + " / " + (compMight.maxSP * 100).ToString("F0")); } catch { fillPercent = 0f; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullStaminaTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, ""); } yShift += (barHeight) + barSpacing; } if (isBloodMage) { rect2.y = rect.y + yShift; try { fillPercent = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("TM_BloodHD"), false).Severity / boostBloodSev; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullBloodMageTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, "" + (pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("TM_BloodHD"), false).Severity).ToString("F0") + " / " + boostBloodSev.ToString("F0")); } catch { fillPercent = 0f; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullBloodMageTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, ""); } yShift += (barHeight) + barSpacing; } if (isBrightmage) { rect2.y = rect.y + yShift; try { if (compMagic.SoL != null) { fillPercent = compMagic.SoL.LightEnergy / compMagic.SoL.LightEnergyMax; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullSoLTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); //Widgets.Label(rect2, "" + compMagic.SoL.LightEnergy.ToString("F0") + " / " + compMagic.SoL.LightEnergyMax.ToString("F0")); } Hediff hd = pawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_LightCapacitanceHD); HediffComp_LightCapacitance hdlc = hd.TryGetComp <HediffComp_LightCapacitance>(); fillPercent = hdlc.LightEnergy / hdlc.LightEnergyMax; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullBrightmageTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, "" + hdlc.LightEnergy.ToString("F0") + " / " + hdlc.LightEnergyMax.ToString("F0")); } catch { fillPercent = 0f; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullBrightmageTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, ""); } yShift += (barHeight) + barSpacing; } if (isMage) { rect2.y = rect.y + yShift; try { fillPercent = compMagic.Mana.CurInstantLevel / compMagic.maxMP; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullManaTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, "" + (compMagic.Mana.CurInstantLevel * 100).ToString("F0") + " / " + (compMagic.maxMP * 100).ToString("F0")); } catch { fillPercent = 0f; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullManaTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, ""); } yShift += (barHeight) + barSpacing; } if (isEnchantedItem) { rect2.y = rect.y + yShift; try { fillPercent = iComp.NecroticEnergy / 100f; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullNecroticTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, "" + (iComp.NecroticEnergy).ToString("F0") + " / " + (100).ToString("F0")); } catch { fillPercent = 0f; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullNecroticTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, ""); } yShift += (barHeight) + barSpacing; } Text.Font = GameFont.Small; Text.Anchor = TextAnchor.UpperLeft; }, true, false, 1f); } } else { Rect overRect = new Rect(topLeft.x + 2, topLeft.y, this.GetWidth(100), 75); //overall rect size (shell) float barHeight; float initialShift = 0; Find.WindowStack.ImmediateWindow(984698, overRect, WindowLayer.GameUI, delegate { barHeight = ((75 - 5) / 1); Rect rect = overRect.AtZero().ContractedBy(6f); //inner, smaller rect rect.height = barHeight; Rect rect2 = rect; //label rect, starts at top Text.Font = GameFont.Tiny; float fillPercent = 0; float yShift = initialShift; Text.Anchor = TextAnchor.MiddleCenter; rect2.y += yShift; fillPercent = 0f; Widgets.FillableBar(rect2, fillPercent, Gizmo_EnergyStatus.FullPsionicTex, Gizmo_EnergyStatus.EmptyShieldBarTex, false); Widgets.Label(rect2, ""); yShift += (barHeight) + 5f; }, true, false, 1f); } return(new GizmoResult(GizmoState.Clear)); }