// Use this for initialization void Start() { playerCurrentHealth = playerHealth; playerAbilities = new BaseEffect[8]; cards = new Animator[3]; playerAbilities[0] = new FireBallSpawn(StandardFireBall, mainCamera, this.transform, 1); playerAbilities[1] = new HealEffect(10); playerAbilities[2] = new AOEDamage(DmgAoe, mainCamera); playerAbilities[3] = new AOEDamage(HealAoe, mainCamera); playerAbilities[4] = new FireBallSpawn(FireBall, mainCamera, this.transform, 1); playerAbilities[5] = new FireBallSpawn(FireBall, mainCamera, this.transform, 2); playerAbilities[6] = new FireBallSpawn(FireBall, mainCamera, this.transform, 3); playerAbilities[7] = new AOEDamage(ShieldAoe, mainCamera); playerMovementScript = GetComponent <Movement>(); for (int i = 0; i < 3; i++) { cards[i] = shopCards[i].GetComponent <Animator>(); displayCardScriptShopCards[i] = shopCards[i].GetComponent <DisplayCard>(); draggableShopCards[i] = shopCards[i].GetComponent <Draggable>(); } currentBossPrefab = currentBossPrefab = Instantiate(enemies[currentBoss], new Vector3(0, 1, 0), enemies[currentBoss].transform.rotation); playerAnimator = GetComponent <Animator>(); //battleWon(); }
public void FillSpellData() { SpellData data = new SpellData() { Name = "Spark Jolt", SpellPrerequisites = new string[0], SpellType = SpellType.Activated, LevelRequirement = 1, ActivationCost = 8, AllowedClasses = new string[] { "Wizard" }, AttributeRequirements = new Dictionary <string, int>() { { "Magic", 10 } } }; BaseEffect effect = DamageEffect.FromDamageEffectData(new DamageEffectData { Name = "Spark Jolt", TargetType = TargetType.Enemy, AttackType = AttackType.Health, DamageType = DamageType.Air, DieType = DieType.D6, NumberOfDice = 3, Modifier = 2 }); data.Effects.Add(effect); spellData.Add("Spark Jolt", data); data = new SpellData() { Name = "Mend", SpellPrerequisites = new string[0], SpellType = SpellType.Activated, LevelRequirement = 1, ActivationCost = 6, AllowedClasses = new string[] { "Priest" }, AttributeRequirements = new Dictionary <string, int>() { { "Magic", 10 } } }; BaseEffect healEffect = HealEffect.FromHealEffectData(new HealEffectData { Name = "Mend", TargetType = TargetType.Self, HealType = HealType.Health, DieType = DieType.D8, NumberOfDice = 2, Modifier = 2 }); data.Effects.Add(healEffect); spellData.Add("Mend", data); }
static Hospital() { effects = new HealEffect[4]; effects[0] = new HealEffect("Health +1 (Range 2)", new LightSequence("R"), true, 2, 1); effects[1] = new HealEffect("Health +1 (Range 3)", new LightSequence("RB"), true, 3, 1); effects[2] = new HealEffect("Health +2 (Range 2)", new LightSequence("RRR"), true, 2, 2); effects[3] = new HealEffect("Health +2 (Range 3)", new LightSequence("RRRB"), false, 3, 2); }
public IEnumerator Heal(HealEffect healEffect, BattleCharacter owner, BattleCharacter target) { int healAmount = healEffect.healAmount; owner.Recover(healAmount); yield return(StartCoroutine(message.ShowAuto(target.CharacterName + "は" + healAmount + "かいふくした"))); yield break; }
public async Task OnTurnStart(PassiveEffectInfo passiveEffectInfo) { int healAmount; if (!IsPercentageValue) { healAmount = FlatValue; } else { healAmount = (int)(passiveEffectInfo.Target.Stats.MaxHp * PercentageValue); } var effect = new HealEffect { HealAmount = healAmount }; passiveEffectInfo.Target.QueueAction(() => { BattleController.Instance.battleCanvas.battleInfoPanel.ShowInfo(passiveEffectInfo.PassiveEffectSourceName); //BattleController.Instance.battleCanvas.BindActionArrow(battler.RectTransform); }); if (Animation != null) { await Animation.PlaySkillAnimation(passiveEffectInfo.Source, new [] { passiveEffectInfo.Target }); } Debug.Log($"{passiveEffectInfo.Source.BattlerName} curou {healAmount} em {passiveEffectInfo.Target.BattlerName}"); //await battler.ReceiveEffect(battler, null, effect); await passiveEffectInfo.Target.ReceiveEffect(new EffectInfo { SkillInfo = new SkillInfo { HasCrit = false, Skill = null, Source = passiveEffectInfo.Source, Target = passiveEffectInfo.Target }, Effect = effect }); passiveEffectInfo.Target.QueueAction(() => { BattleController.Instance.battleCanvas.battleInfoPanel.HideInfo(); //BattleController.Instance.battleCanvas.UnbindActionArrow(); }); }
public static Spell FromSpellData(SpellData data) { Spell spell = new Spell { name = data.Name, levelRequirement = data.LevelRequirement, spellType = data.SpellType, activationCost = data.ActivationCost, coolDown = data.CoolDown, Range = data.Range, AreaOfEffect = data.AreaOfEffect, AngleOfEffect = data.AngleOfEffect, CastTime = data.CastTime }; foreach (string s in data.AllowedClasses) { spell.allowedClasses.Add(s.ToLower()); } foreach (string s in data.AttributeRequirements.Keys) { spell.attributeRequirements.Add( s.ToLower(), data.AttributeRequirements[s]); } foreach (string s in data.SpellPrerequisites) { spell.SpellPrerequisites.Add(s); } foreach (BaseEffectData s in data.Effects) { if (s is DamageEffectData damage) { spell.Effects.Add(DamageEffect.FromDamageEffectData(damage)); } if (s is HealEffectData heal) { spell.Effects.Add(HealEffect.FromHealEffectData(heal)); } } return(spell); }
public static Talent FromTalentData(TalentData data) { Talent talent = new Talent { name = data.Name, levelRequirement = data.LevelRequirement, talentType = data.TalentType, activationCost = data.ActivationCost, coolDown = data.CoolDown, Range = data.Range, AreaOfEffect = data.AreaOfEffect, AngleOfEffect = data.AngleOfEffect, CastTime = data.CastTime }; foreach (string s in data.AllowedClasses) { talent.allowedClasses.Add(s.ToLower()); } foreach (string s in data.AttributeRequirements.Keys) { talent.attributeRequirements.Add( s.ToLower(), data.AttributeRequirements[s]); } foreach (string s in data.TalentPrerequisites) { talent.talentPrerequisites.Add(s); } foreach (BaseEffectData s in data.Effects) { if (s is DamageEffectData damage) { talent.Effects.Add(DamageEffect.FromDamageEffectData(damage)); } if (s is HealEffectData heal) { talent.Effects.Add(HealEffect.FromHealEffectData(heal)); } } return(talent); }
public static Spell BuildTestHealingSpell() { Spell returnSpell = new Spell(); List <Condition> conditions = new List <Condition> { new TargetAliveCondition(1) }; Effect newEffect = new HealEffect(new EffectSourceSelector(), new EffectHolderSelector(), 5, conditions); returnSpell.Cooldown = 3; returnSpell.ValidTarget = ValidTarget.Ally; returnSpell.Effects = new List <Effect> { newEffect }; return(returnSpell); }
void ProcessEffectSelection(int i) { Debug.Log(" processeffect " + i); if (typeof(DamageEffect).Name == EffectNames[i]) { DamageEffect tmp = new GameObject().AddComponent <DamageEffect>(); tmp.transform.SetParent(spell.transform); tmp = new DamageEffect(); return; } if (typeof(DamageOverTime).Name == EffectNames[i]) { DamageOverTime tmp = new GameObject().AddComponent <DamageOverTime>(); tmp.transform.SetParent(spell.transform); tmp = new DamageOverTime(); return; } if (typeof(HealEffect).Name == EffectNames[i]) { HealEffect tmp = new GameObject().AddComponent <HealEffect>(); tmp.transform.SetParent(spell.transform); tmp = new HealEffect(); return; } if (typeof(HealOverTime).Name == EffectNames[i]) { HealOverTime tmp = new GameObject().AddComponent <HealOverTime>(); tmp.transform.SetParent(spell.transform); tmp = new HealOverTime(); return; } if (typeof(BuffEffect).Name == EffectNames[i]) { BuffEffect tmp = new GameObject().AddComponent <BuffEffect>(); tmp.transform.SetParent(spell.transform); tmp = new BuffEffect(); return; } }
public void HealApplied_HealthNotNegative() { var effect = new HealEffect { Amount = 1000, TargetingMode = TargetingMode.YourActive }; var player = new Player(); player.ActivePokemonCard = new PokemonCard() { DamageCounters = 30, Hp = 100 }; effect.Process(new GameField(), player, null, null); Assert.Equal(0, player.ActivePokemonCard.DamageCounters); }
void ShowSpellEffects() { Debug.Log(spell.transform.childCount); for (int i = 0; i < spell.transform.childCount; i++) { var effect = spell.transform.GetChild(i).GetComponent <SpellEffect>(); Debug.Log(effect.spellType); Debug.Log("teeest " + (effect.spellType == SpellEffect.SpellType.DAMAGEEFFECT)); if (effect.spellType == SpellEffect.SpellType.DAMAGEEFFECT) { effect.test(); EditorGUILayout.LabelField("Damage On hit"); var tmp = effect as DamageEffect; Debug.Log(tmp == null); Debug.Log(effect.GetType()); var damage = tmp.SpellEditorDamage; damage = EditorGUILayout.IntField("Damage", damage); if (damage != tmp.SpellEditorDamage) { tmp.SetDamageEffect(damage); } } if (effect.spellType == SpellEffect.SpellType.DAMAGEOVERTIME) { EditorGUILayout.LabelField("Damage Over Time"); DamageOverTime tmp = effect as DamageOverTime; int damage = tmp.SpellEditorDamage; int turn = tmp.SpellEditorTurns; damage = EditorGUILayout.IntField("Damage", damage); turn = EditorGUILayout.IntField("Turn", turn); if (damage != tmp.SpellEditorDamage || turn != tmp.SpellEditorTurns) { tmp.SetDamageOverTime(damage, turn); } } if (effect.spellType == SpellEffect.SpellType.HEAL) { EditorGUILayout.LabelField("Heal On hit"); HealEffect tmp = effect as HealEffect; int heal = tmp.SpellEditorHeal; heal = EditorGUILayout.IntField("Heal", heal); if (heal != tmp.SpellEditorHeal) { tmp.SetHealEffect(heal); } } if (effect.spellType == SpellEffect.SpellType.HEALOVERTIME) { EditorGUILayout.LabelField("Heal Over Time"); HealOverTime tmp = effect as HealOverTime; int heal = tmp.SpellEditorHeal; int turn = tmp.SpellEditorTurns; heal = EditorGUILayout.IntField("Heal", heal); turn = EditorGUILayout.IntField("Turn", turn); if (heal != tmp.SpellEditorHeal || turn != tmp.SpellEditorTurns) { tmp.SetHealOverTime(heal, turn); } } if (effect.spellType == SpellEffect.SpellType.BUFFEFFECT) { EditorGUILayout.LabelField("Buff Effect"); BuffEffect tmp = effect as BuffEffect; int index = tmp.SpellEditorIndex; int amount = tmp.SpellEditorAmount; int turn = tmp.SpellEditorTurn; index = EditorGUILayout.Popup("Choose a stat", index, tmp.stats); amount = EditorGUILayout.IntField("Amount", amount); turn = EditorGUILayout.IntField("Turn", turn); if (index != tmp.SpellEditorIndex || amount != tmp.SpellEditorAmount || turn != tmp.SpellEditorTurn) { tmp.SetBuffEffect(index, amount, turn); } } if (GUILayout.Button("Remove Effect")) { DestroyImmediate(spell.transform.GetChild(i).gameObject); } } }