public override void Trigger(EffectArgs args) { if (Duration != INFINITE) { Duration--; } if (!(args is BasicEffectArgs basicEffectArgs)) { return; } var message = $"{basicEffectArgs.Target.Name} takes {Damage} damage from Bleeding!"; var eventMediator = Object.FindObjectOfType <EventMediator>(); eventMediator.Broadcast(GlobalHelper.SendMessageToConsole, this, message); basicEffectArgs.Target.SubtractHealth(Damage); var animHelper = basicEffectArgs.Target.CombatSpriteInstance.GetComponent <CombatAnimationHelper>(); animHelper.damage = Damage; animHelper.criticalHit = false; if (basicEffectArgs.Target.IsDead()) { eventMediator.StartCoroutine(basicEffectArgs.Target.PlayDeathAnimation()); eventMediator.Broadcast(GlobalHelper.EndTurn, this); } else { basicEffectArgs.Target.PlayHitAnimation(); } }
private void DrawDamageEffect(EffectArgs effect) { effect.damage.type = (DamageType)EditorGUILayout.EnumPopup("Damage", effect.damage.type);; string[] validOptions = { ActorAttributeType.HP.ToString(), ActorAttributeType.MP.ToString() }; int stringAttr = EditorGUILayout.Popup("Attribute", (int)effect.damage.attribute, validOptions); effect.damage.attribute = (ActorAttributeType)stringAttr; effect.damage.amountAsPerc = EditorGUILayout.Toggle("Use %", effect.damage.amountAsPerc); if (effect.damage.amountAsPerc) { effect.damage.amount = EditorGUILayout.Slider("Amount", effect.damage.amount, 0, 100f); effect.damage.amount = Mathf.Round(effect.damage.amount); } else { effect.damage.amount = EditorGUILayout.FloatField("Amount", effect.damage.amount); } effect.damage.varianceAsPerc = EditorGUILayout.Toggle("Use %", effect.damage.varianceAsPerc); if (effect.damage.varianceAsPerc) { effect.damage.variance = EditorGUILayout.Slider("Variance", effect.damage.variance, 0, 100f); effect.damage.variance = Mathf.Round(effect.damage.variance); } else { effect.damage.variance = EditorGUILayout.FloatField("Variance", effect.damage.variance); } effect.damage.canCritical = EditorGUILayout.Toggle("Critical", effect.damage.canCritical); }
public override void Trigger(EffectArgs args) { if (Duration != INFINITE) { Duration--; } var basicEffectArgs = args as BasicEffectArgs; if (basicEffectArgs == null) { return; } var message = $"{basicEffectArgs.Target.Name} is stunned!"; var eventMediator = Object.FindObjectOfType <EventMediator>(); eventMediator.Broadcast(GlobalHelper.SendMessageToConsole, this, message); //todo might need delay //todo need to override any effect that would cause someone to run or attack like Panic eventMediator.Broadcast(GlobalHelper.EndTurn, this); }
public override void Trigger(EffectArgs args) { if (Duration != INFINITE) { Duration--; } var basicEffectArgs = args as BasicEffectArgs; if (basicEffectArgs == null) { return; } var eventMediator = Object.FindObjectOfType <EventMediator>(); if (!basicEffectArgs.Target.IsStunned() && basicEffectArgs.Target.CanApplyEffect(this)) { if (Random.Range(1, 101) > PanicChance) { return; } var message = $"{basicEffectArgs.Target.Name} panics!"; eventMediator.Broadcast(GlobalHelper.SendMessageToConsole, this, message); var combatManager = Object.FindObjectOfType <CombatManager>(); var targets = combatManager.TurnOrder.ToList(); targets.Remove(basicEffectArgs.Target); targets = GlobalHelper.ShuffleList(targets); bool attackUsed = false; foreach (var target in targets.ToArray()) { foreach (var ability in basicEffectArgs.Target.Abilities.Values) { if (ability.IsPassive || !ability.TargetInRange(target) || ability.TargetType == TargetType.Friendly || ability.ApCost > basicEffectArgs.Target.Stats.CurrentActionPoints) { continue; } ability.Use(target); attackUsed = true; break; } if (attackUsed) { break; } } } eventMediator.Broadcast(GlobalHelper.EndTurn, this); }
internal void GetEffectArgs(out EffectArgs effectParams) { effectParams.CellOffset = (Vector3)m_metadata.PositionOffset; effectParams.CellScale = m_metadata.PositionScale; effectParams.CellRelativeCamera = (Vector3)(MyRenderCamera.Position - (m_worldMatrix.Translation + m_metadata.PositionOffset)); effectParams.MorphDebug = MathHelper.Clamp(0 - m_metadata.Cell.Lod, 0f, 1f); Vector2 lodBounds; MyClipmap.ComputeLodViewBounds(m_scaleGroup, m_metadata.Cell.Lod, out lodBounds.X, out lodBounds.Y); effectParams.Bounds = lodBounds; }
private void DrawEffect(EffectArgs effect) { effect.type = (EffectType)EditorGUILayout.EnumPopup("Type", effect.type); if (effect.type == EffectType.Recover) { DrawRecoverEffect(effect); } else if (effect.type == EffectType.Damage) { DrawDamageEffect(effect); } else if (effect.type == EffectType.ClearState) { effect.state = (ActorStatus)EditorGUILayout.EnumPopup("State", effect.state); } }
private void DrawEffectPreview(EffectArgs effect) { if (effect.type == EffectType.Recover) { EditorGUILayout.BeginVertical("GroupBox", GUILayout.Width(350)); var baseValue = " " + effect.recover.amount + "" + (effect.recover.amountAsPerc ? "%" : ""); var variantValue = " " + effect.recover.variance + "" + (effect.recover.varianceAsPerc ? "%" : ""); EditorGUILayout.LabelField($"{effect.type}=> [{baseValue} +- ({variantValue})]"); EditorGUILayout.EndVertical(); } else if (effect.type == EffectType.Damage) { EditorGUILayout.BeginVertical("GroupBox", GUILayout.Width(350)); var baseValue = " " + effect.damage.amount + "" + (effect.damage.amountAsPerc ? "%" : ""); var variantValue = " " + effect.damage.variance + "" + (effect.damage.varianceAsPerc ? "%" : ""); EditorGUILayout.LabelField($"{effect.type}=> [{baseValue} +- ({variantValue})]"); EditorGUILayout.EndVertical(); } }
internal void GetEffectArgs(out EffectArgs effectParams) { effectParams.CellOffset = (Vector3)m_cellOffset; effectParams.CellScale = m_cellScale; effectParams.CellRelativeCamera = (Vector3)(MyRenderCamera.Position - (m_worldMatrix.Translation + m_cellOffset)); effectParams.MorphDebug = MathHelper.Clamp(MyClipmap.DebugClipmapMostDetailedLod - m_coord.Lod, 0f, 1f); Vector2 lodBounds; MyClipmap.ComputeLodViewBounds(m_scaleGroup, m_coord.Lod, out lodBounds.X, out lodBounds.Y); effectParams.Bounds = lodBounds; }
protected override void OnTrigger(EffectArgs e) { Console.WriteLine($"Effect {Name} triggered, cancelling further triggers:"); e.CancelTrigger = true; }
protected override void OnTrigger(EffectArgs e) { }
public SkillData(int id) : base(id) { effect = new EffectArgs(); }
public ItemData(int id) : base(id) { effect = new EffectArgs(); }