public static void Postfix(CombatHUDPhaseDisplay __instance) { //SkillBasedInit.Logger.LogIfDebug($"CombatHUDPhaseDisplay:IndicateFuturePhase:post - init"); __instance.FlagOutline.color = Color.white; __instance.NumText.color = Color.white; Hostility hostility = __instance.Combat.HostilityMatrix.GetHostility(__instance.DisplayedActor.team, __instance.Combat.LocalPlayerTeam); bool isPlayer = __instance.DisplayedActor.team == __instance.Combat.LocalPlayerTeam; Color color = Mod.Config.FriendlyUnactivated; if (hostility == Hostility.ENEMY) { color = Mod.Config.EnemyUnactivated; } else { if (!isPlayer) { switch (hostility) { case Hostility.FRIENDLY: color = Mod.Config.AlliedUnactivated; break; case Hostility.NEUTRAL: color = Mod.Config.NeutralUnactivated; break; } } } __instance.FlagFillImage.color = color; }
public static void Postfix(CombatHUDPhaseDisplay __instance, bool isPlayer, Hostility hostility) { //SkillBasedInit.Logger.LogIfDebug($"CombatHUDPhaseDisplay:IndicateCurrentPhase:post - init"); __instance.FlagOutline.color = Color.white; __instance.NumText.color = Color.white; Color color = Mod.Config.FriendlyUnactivated; if (hostility == Hostility.ENEMY) { color = Mod.Config.EnemyUnactivated; } else { if (!isPlayer) { switch (hostility) { case Hostility.FRIENDLY: color = Mod.Config.AlliedUnactivated; break; case Hostility.NEUTRAL: color = Mod.Config.NeutralUnactivated; break; } } } __instance.FlagFillImage.color = color; }
public static bool Prefix(CombatHUDPhaseTrack __instance, bool isPlayer, Hostility hostility, int ___currentPhase, CombatHUDPhaseBar[] ___phaseBars) { Mod.Log.Trace?.Write("CHUDPT::RPC - entered."); if (__instance == null || ___phaseBars == null) { return(true); } if (!ModState.Combat.TurnDirector.IsInterleaved) { return(true); } // Reconcile phase (from 1 - X) with display (X to 1) int initNum = (Mod.MaxPhase + 1) - ___currentPhase; int[] phaseBounds = PhaseHelper.CalcPhaseIconBounds(___currentPhase); Mod.Log.Trace?.Write($" For currentPhase: {___currentPhase} phaseBounds are: [ {phaseBounds[0]} {phaseBounds[1]} {phaseBounds[2]} {phaseBounds[3]} {phaseBounds[4]} ]"); for (int i = 0; i < 5; i++) { if (phaseBounds[i] > initNum) { Mod.Log.Trace?.Write($" Setting phase: {phaseBounds[i]} as past phase."); ___phaseBars[i].IndicatePastPhase(); } else if (phaseBounds[i] == initNum) { Mod.Log.Trace?.Write($" Setting phase: {phaseBounds[i]} as current phase."); ___phaseBars[i].IndicateCurrentPhase(isPlayer, hostility); } else { Mod.Log.Trace?.Write($" Setting phase: {phaseBounds[i]} as future phase."); ___phaseBars[i].IndicateFuturePhase(isPlayer, hostility); } ___phaseBars[i].Text.SetText($"{phaseBounds[i]}"); } if (phaseBounds[0] != Mod.MaxPhase) { ___phaseBars[0].Text.SetText("P"); } if (phaseBounds[4] != Mod.MinPhase) { ___phaseBars[4].Text.SetText("F"); } return(false); }
public DiscordEmbed GetLocationEmbed() { var builder = new DiscordEmbedBuilder() .WithTitle(DisplayName); //.WithDescription(Description); var desc = new System.Text.StringBuilder(Description); var footer = new System.Text.StringBuilder(); footer.Append("Cmd Help: .travelto <name>"); // Hostility Colors switch (Hostility.ToLower()) { case "sanctuary": builder.WithColor(DiscordColor.Gold); break; case "friendly": builder.WithColor(DiscordColor.SpringGreen); break; case "neutral": builder.WithColor(DiscordColor.CornflowerBlue); break; case "caution": builder.WithColor(DiscordColor.Orange); break; case "dangerous": builder.WithColor(DiscordColor.IndianRed); break; case "hostile": builder.WithColor(DiscordColor.Red); break; default: builder.WithColor(DiscordColor.White); break; } // Services if (Places.Count > 0) { desc.AppendLine(); desc.AppendLine("**Places**"); desc.AppendLine(string.Join(", ", Places.Keys)); footer.Append(", .enter <name>"); } // Exits desc.AppendLine(); desc.AppendLine("**Exits**"); desc.AppendLine(string.Join(", ", LocationConnections)); builder.WithDescription(desc.ToString()); builder.WithFooter(footer.ToString()); return(builder.Build()); }
public ItemDrop(int value, ObjectType mObjectType, ContentManager content, SpriteState defaultState, Vector2 SpritePosition, Hostility hostility) : base(mObjectType, content, defaultState, SpritePosition, hostility) { this.mObjectType = mObjectType; mIsTagged = false; mTimeToLive = 10000; mTimer = 0; mSpawnLocation = SpritePosition; this.mValue = value; mSprite = new Sprite(content); SetItemDropAnimation(); mSprite.LoadContent(); mSprite.WorldPosition = mSpawnLocation; }
public Projectile(ObjectType mObjectType, SpriteState defaultState, Vector2 SpritePosition, Hostility hostility, GameObject mProjectileTargetObject, GameObject mProjectileCaster, float mProjectileDamage, ContentManager content) : base(mObjectType, content, defaultState, SpritePosition, hostility) { mObjectID = mGlobalID; mGlobalID++; mSpeed = 5.0f; randomNumberGenerator = new Random(); this.mProjectileDamage = mProjectileDamage; this.mProjectileCaster = mProjectileCaster; this.mProjectileTargetObject = mProjectileTargetObject; this.mCurrentTarget = mProjectileTargetObject.Sprite.WorldPosition; this.mTrackingNumber = this.mProjectileTargetObject.mObjectID; mHasLanded = false; }
public Entity(EntityPrototype proto) { prototype = ScriptableObject.Instantiate(proto); mEntityType = prototype.entityType; entityName = proto.mName; Game = GameManager.instance; Map = MapManager.instance; ignoreTilemap = proto.ignoreTilemap; hostility = prototype.hostility; abilities = new List <Ability>(); //mRenderer = GameObject.Instantiate<EntityRenderer>(); mCollidesWith = proto.CollidesWith; statusEffects = new List <StatusEffect>(); abilityFlags = new AbilityFlags(); abilityFlags.Initialize(); baseGravityMultiplier = proto.baseGravityMultiplier; gravityMultiplier = baseGravityMultiplier; crushDamage = proto.crushDamage; //if (colorPallete != null && colorPallete.Count > 0) //ColorSwap.SwapSpritesTexture(GetComponent<SpriteRenderer>(), colorPallete); foreach (AbilityFlag flag in proto.abilityFlags) { abilityFlags.SetFlag(flag, true); } foreach (Ability ability in proto.baseAbilities) { Ability temp = ScriptableObject.Instantiate(ability); temp.OnGainTrigger(this); } mUpdateId = Game.AddToUpdateList(this); Body = new PhysicsBody(this, new CustomAABB(Position, proto.bodySize, new Vector2(0, proto.bodySize.y))); Body.mIsKinematic = proto.kinematic; Body.mIgnoresGravity = proto.ignoreGravity; List <Color> palette = proto.colorPallete; //Stats mStats = new Stats(); mStats.SetStats(prototype.stats); instadeathSFX = Resources.Load <AudioClip>("Sounds/SFX/splatter"); }
public void SetObject(Sprite s, Hostility h) { // print(portrait); switch (h) { case Hostility.Friendly: background.color = Color.green; break; case Hostility.Neutral: background.color = Color.yellow; break; case Hostility.Hostile: background.color = Color.red; break; } portrait.sprite = s; }
public static List <GridEntity> GetAllEntitiesInTileList(List <Tile> activeTiles, Hostility hostility) { return(activeTiles .Where(tile => tile.occupier != null) .Where(tile => { if (hostility == Hostility.HOSTILE) { return tile.occupier.isHostile; } else if (hostility == Hostility.FRIENDLY) { return tile.occupier.isFriendly || tile.occupier.isAllied; } else { return false; } }) .Select(tile => tile.occupier) .ToList()); }
public GameObject(ObjectType mObjectType, ContentManager content, SpriteState defaultState, Vector2 SpritePosition, Hostility hostility) { this.mDirection = Vector2.Zero; this.mObjectType = mObjectType; this.mRace = mRace; this.mSpriteState = defaultState; this.mSprite = new Sprite(content); this.hostility = hostility; mInPlayItemDropList = new JLinkedList(); mProjectileAnimationList = new List<Animation>(); mUnitAnimationList = new List<Animation>(); this.mSprite.WorldPosition = SpritePosition; if (this is Hero) { mPotentialTargetListList.InsertLast(this); } if (this.hostility == Hostility.CASTLE || this is Hero) { mInPlayObjectList.InsertLast(this); } if (this.hostility == Hostility.PROJECTILE) { mInPlayProjectileList.InsertLast(this); } // I know what type of game object I am now, so populate // my list of available animations. PopulateLists(); // Initialize the default animation. if (this.mSprite.AssetName == null && this.hostility != Hostility.PROJECTILE && this.hostility != Hostility.ITEMDROP) { this.mSprite.AssetName = mUnitAnimationList.ElementAt(0).mAnimationName; } }
// Iterate the ammoModePairs on the weapon to find the highest direct damage, heat damage, and stab damage private static (WeaponAttackEval damage, WeaponAttackEval heat, WeaponAttackEval stab) OptimizeAmmoPairForAttack(Weapon weapon, AttackDetails details) { WeaponAttackEval damage = new WeaponAttackEval() { Weapon = weapon }; WeaponAttackEval heat = new WeaponAttackEval() { Weapon = weapon }; WeaponAttackEval stab = new WeaponAttackEval() { Weapon = weapon }; BehaviorTree bTree = details.Attacker.BehaviorTree; try { float attackTypeWeight = AIHelper.GetCachedBehaviorVariableValue(bTree, BehaviorVariableName.Float_ShootingDamageMultiplier).FloatVal;; // Damage prediction assumes an attack quality of Solid. It doesn't apply targetMultis either Dictionary <AmmoModePair, WeaponFirePredictedEffect> damagePredictions = CleverGirlHelper.gatherDamagePrediction(weapon, details.AttackPosition, details.Target); foreach (KeyValuePair <AmmoModePair, WeaponFirePredictedEffect> kvp in damagePredictions) { AmmoModePair ammoModePair = kvp.Key; WeaponFirePredictedEffect weaponFirePredictedEffect = kvp.Value; Mod.Log.Debug?.Write($" - Evaluating ammoId: {ammoModePair.ammoId} with modeId: {ammoModePair.modeId}"); WeaponAttackEval wae = new WeaponAttackEval() { Weapon = weapon, AmmoMode = ammoModePair }; foreach (DamagePredictionRecord dpr in weaponFirePredictedEffect.predictDamage) { Hostility targetHostility = SharedState.Combat.HostilityMatrix.GetHostility(details.Attacker.team, dpr.Target.team); if (targetHostility == Hostility.FRIENDLY) { // Friendly and self damage weights directly into a self damage, and doesn't contribute to any attacks float damageMulti; if (details.Attacker.GUID == dpr.Target.GUID) { damageMulti = Mod.Config.Weights.DamageMultis.Self; } else { damageMulti = Mod.Config.Weights.DamageMultis.Friendly; } wae.EVFriendlyDmg += dpr.ToHit * dpr.Normal * damageMulti; wae.EVFriendlyDmg += dpr.ToHit * dpr.AP * damageMulti; wae.EVFriendlyDmg += dpr.ToHit * dpr.Heat * damageMulti; wae.EVFriendlyDmg += dpr.ToHit * dpr.Instability * damageMulti; } else if (targetHostility == Hostility.NEUTRAL) { // Neutrals are weighted lower, to emphasize attacking enemies more directly wae.EVDirectDmg += dpr.ToHit * dpr.Normal * Mod.Config.Weights.DamageMultis.Neutral; wae.EVStructDam += dpr.ToHit * dpr.AP * Mod.Config.Weights.DamageMultis.Neutral; wae.EVHeat += dpr.ToHit * dpr.Heat * Mod.Config.Weights.DamageMultis.Neutral; wae.EVStab += dpr.ToHit * dpr.Instability * Mod.Config.Weights.DamageMultis.Neutral; } else { wae.EVDirectDmg += dpr.ToHit * dpr.Normal; wae.EVStructDam += dpr.ToHit * dpr.AP; wae.EVHeat += dpr.ToHit * dpr.Heat; wae.EVStab += dpr.ToHit * dpr.Instability; } if (!dpr.isAoE && dpr.ToHit > wae.ToHit) { wae.ToHit = dpr.ToHit; } } if ((wae.EVDirectDmg + wae.EVStructDam) >= (damage.EVDirectDmg + damage.EVStructDam)) { damage = wae; } if (wae.EVHeat >= heat.EVHeat) { heat = wae; } if (wae.EVStructDam >= stab.EVStructDam) { stab = wae; } } } catch (Exception e) { Mod.Log.Error?.Write(e, "Failed to calculate weapon damageEV!"); } return(damage, heat, stab); }
public virtual void SetHostility(Hostility value) { Hostility = value; }