Пример #1
0
    public void AttrParalyze(ActiveAbility ability, AbilityAttribute attr)
    {
        if (!(ability is UtilityAbility))
        {
            return;
        }
        var   duration = (float)attr.FindParameter("duration").value;
        float radius   = 0;

        if (attr.FindParameter("radius") != null)
        {
            radius = (float)attr.FindParameter("radius").value * 3;
        }
        var utilityAbility = (UtilityAbility)ability;
        List <StatusEffectHost> targets = new List <StatusEffectHost>();

        if (utilityAbility.targetType == "none" && radius > 0)
        {
            targets = GetTargetsWithinRadiusOfPoint(transform.position, radius);
        }
        else if (utilityAbility.targetType == "point" && radius > 0 && GetMouseCursorTargetLocation() != Vector3.positiveInfinity)
        {
            targets = GetTargetsWithinRadiusOfPoint(GetMouseCursorTargetLocation(), radius);
        }
        else if (utilityAbility.targetType == "point" && radius == 0 && GetMouseCursorTargetCharacter() != null)
        {
            targets.Add(GetMouseCursorTargetCharacter());
        }
        foreach (var target in targets)
        {
            target.AddStatusEffect("paralysis", (float)attr.FindParameter("duration").value, inflicter: GetComponent <Character>(), good: false, ability: ability);
        }
    }
Пример #2
0
    public static void SpeedMinus(Character target, AbilityAttribute attr)
    {
        var degree   = (float)attr.FindParameter("degree").value;
        var duration = (float)attr.FindParameter("duration").value;

        target.GetComponent <StatusEffectHost>().AddStatusEffect("speed-", duration, degree);
    }
Пример #3
0
    private static float GetSpeedPlus(UtilityAbility ability, AbilityAttribute attribute)
    {
        var degree   = (float)attribute.FindParameter("degree").value;
        var duration = (float)attribute.FindParameter("duration").value;

        return(86f * duration / 5f * degree);
    }
Пример #4
0
    public void AttrSpeedPlus(ActiveAbility ability, AbilityAttribute attr)
    {
        var degree   = (float)attr.FindParameter("degree").value;
        var duration = (float)attr.FindParameter("duration").value;

        FindTarget().GetComponent <StatusEffectHost>().AddStatusEffect("speed+", duration, degree, good: true);
    }
Пример #5
0
    private static float GetParalyze(UtilityAbility ability, AbilityAttribute attribute)
    {
        var   duration = (float)attribute.FindParameter("duration").value;
        float radius   = 0f;

        if (attribute.ContainsAttribute("radius"))
        {
            radius = (float)attribute.FindParameter("radius").value;
        }
        var pointCost = 280f * duration / 10f;

        if (radius == 2)
        {
            pointCost *= 2f;
        }
        else if (radius == 4)
        {
            pointCost *= 8f;
        }
        else if (radius == 6)
        {
            pointCost *= 18f;
        }
        else
        {
            pointCost *= 32f;
        }
        return(pointCost);
    }
Пример #6
0
    private static float GetSpeedMinus(AttackAbility ability, AbilityAttribute attribute)
    {
        var degree   = (float)attribute.FindParameter("degree").value;
        var duration = (float)attribute.FindParameter("duration").value;

        return(ability.points * degree / 10f * duration);
    }
Пример #7
0
    private static string SpeedMinusDescription(AttackAbility ability, AbilityAttribute attribute)
    {
        var degree   = (int)(((float)attribute.FindParameter("degree").value) * 100f);
        var duration = (float)attribute.FindParameter("duration").value;

        return("Slow target's movement by " + degree.ToString() + "% for " + Mathf.FloorToInt(duration).ToString() + " seconds.\n");
    }
Пример #8
0
    public static void JumpBack(Character attacker, Character target, AbilityAttribute attr)
    {
        if (attr.FindParameter("degree") == null)
        {
            return;
        }
        var degree = (float)attr.FindParameter("degree").value;
        var obj    = attacker.gameObject.AddComponent <PushingEffect>();

        obj.Initialize(attacker.transform.position - attacker.transform.forward * degree, 0.5f);
        attacker.GetComponent <AbilityUser>().RpcAddPushingEffect(target.transform.position - attacker.transform.forward * degree, 0.5f);
    }
Пример #9
0
    private static string BoostStatDescription(Ability ability, AbilityAttribute attribute)
    {
        switch ((string)attribute.FindParameter("stat").value)
        {
        case "strength":
            return("Increases Strength by " + attribute.FindParameter("degree").value.ToString() + ".\n");

        case "dexterity":
            return("Increases Dexterity by " + attribute.FindParameter("degree").value.ToString() + ".\n");

        case "constitution":
            return("Increases Constitution by " + attribute.FindParameter("degree").value.ToString() + ".\n");

        case "intelligence":
            return("Increases Intelligence by " + attribute.FindParameter("degree").value.ToString() + ".\n");

        case "wisdom":
            return("Increases Wisdom by " + attribute.FindParameter("degree").value.ToString() + ".\n");

        case "luck":
            return("Increases Luck by " + attribute.FindParameter("degree").value.ToString() + ".\n");

        default:
            return("Increases UNKNOWN ATTRIBUTE by " + attribute.FindParameter("degree").value.ToString() + ".\n");
        }
    }
Пример #10
0
    public static void PullTowards(Character attacker, Character target, AbilityAttribute attr)
    {
        if (attr.FindParameter("degree") == null)
        {
            return;
        }
        float distance = (float)attr.FindParameter("degree").value;

        if (distance >= 1 && distance <= 10)
        {
            var obj = target.gameObject.AddComponent <PushingEffect>();
            obj.Initialize(target.transform.position - attacker.transform.forward * (distance - 1), 0.5f);
            target.GetComponent <AbilityUser>().RpcAddPushingEffect(target.transform.position - attacker.transform.forward * (distance - 1), 0.5f);
        }
    }
Пример #11
0
    public void AttrHealAll(ActiveAbility ability, AbilityAttribute attr)
    {
        float factor = 10;

        if (GetComponent <PlayerCharacter>() != null)
        {
            factor *= GetComponent <PlayerCharacter>().weapon.attackPower;
        }
        else
        {
            factor *= GetComponent <Monster>().attackFactor;
        }
        int level = 1;

        if (GetComponent <ExperienceGainer>() != null)
        {
            level = GetComponent <ExperienceGainer>().level;
        }
        else
        {
            level = GetComponent <MonsterScaler>().level;
        }
        //factor *= SecondaryStatUtility.CalcHealingMultiplier(GetComponent<Character>().wisdom, level);
        factor *= CharacterAttribute.attributes["healingMultiplier"].instances[GetComponent <Character>()].TotalValue / 100f;
        //var healingAmount = (int)((float)attr.FindParameter("degree").value * factor * FindTarget().GetComponent<Health>().healingMultiplier);
        var healingAmount = (int)((float)attr.FindParameter("degree").value *factor *CharacterAttribute.attributes["receivedHealing"].instances[FindTarget()].TotalValue / 100f);

        //foreach (var monster in Monster.monsters) if (monster.GetComponent<MonsterCombatant>().InCombat()) monster.GetComponent<Health>().Heal(healingAmount);
        foreach (var monster in Monster.monsters)
        {
            monster.GetComponent <Health>().Heal(healingAmount);                                      // temp
        }
        GetComponent <AudioGenerator>().PlaySoundByName("sfx_magic_heal2");
    }
Пример #12
0
    private static string SpeedMinusDescription(Ability ability, AbilityAttribute attribute)
    {
        var utilityAbility = ability as UtilityAbility;

        if (utilityAbility.targetType == "none")
        {
            return("Slows all enemies within radius " + Mathf.FloorToInt((float)(attribute.FindParameter("radius").value)).ToString() + " by " + Mathf.FloorToInt((float)attribute.FindParameter("degree").value * 100f).ToString() + "% for " + Mathf.FloorToInt((float)attribute.FindParameter("duration").value).ToString() + " seconds.\n");
        }
        else if (utilityAbility.targetType == "point" && attribute.FindParameter("radius") != null)
        {
            return("Slows all enemies within radius " + Mathf.FloorToInt((float)attribute.FindParameter("radius").value).ToString() + " of targeted point by " + Mathf.FloorToInt((float)attribute.FindParameter("degree").value * 100f).ToString() + "% for " + Mathf.FloorToInt((float)attribute.FindParameter("duration").value).ToString() + " seconds.\n");
        }
        else
        {
            return("Slows targeted enemy by " + Mathf.FloorToInt((float)attribute.FindParameter("degree").value * 100f).ToString() + "% for " + Mathf.FloorToInt((float)attribute.FindParameter("duration").value).ToString() + " seconds.\n");
        }
    }
Пример #13
0
    public void AttrTimestop(ActiveAbility ability, AbilityAttribute attr)
    {
        var    duration = (float)attr.FindParameter("duration").value;
        var    radius   = ability.radius;
        string tag      = GetComponent <Character>().oppositeFaction;

        AddStatusEffectToAllWithTag(tag, "paralysis", duration, distance: radius);
    }
Пример #14
0
    public static void Knockback(Character attacker, Character target, AbilityAttribute attr)
    {
        float degree = (float)attr.FindParameter("degree").value;
        var   obj    = target.gameObject.AddComponent <PushingEffect>();

        obj.Initialize(target.transform.position + attacker.transform.forward * degree, 0.25f);
        target.GetComponent <AbilityUser>().AddPushingEffect(target.transform.position + attacker.transform.forward * degree, 0.25f);
    }
Пример #15
0
    private static string ParalyzeDescription(Ability ability, AbilityAttribute attribute)
    {
        var utilityAbility = ability as UtilityAbility;

        if (utilityAbility.targetType == "none")
        {
            return("Paralyze all enemies within radius " + Mathf.FloorToInt((float)attribute.FindParameter("radius").value).ToString() + " for " + Mathf.FloorToInt((float)attribute.FindParameter("duration").value).ToString() + " seconds.\n");
        }
        else if (utilityAbility.targetType == "point" && attribute.FindParameter("radius") != null)
        {
            return("Paralyze all enemies within radius " + Mathf.FloorToInt((float)attribute.FindParameter("radius").value).ToString() + " of targeted point for " + Mathf.FloorToInt((float)attribute.FindParameter("duration").value).ToString() + " seconds.\n");
        }
        else
        {
            return("Paralyze targeted enemy for " + Mathf.FloorToInt((float)attribute.FindParameter("duration").value).ToString() + " seconds.\n");
        }
    }
Пример #16
0
    public static void Blind(Character attacker, Character target, AbilityAttribute attr)
    {
        target.GetComponent <StatusEffectHost>().AddStatusEffect("blind", (float)attr.FindParameter("duration").value, inflicter: attacker);
        var name = target.gameObject.name;

        if (name == "kittenCharacter(Clone)")
        {
            name = "Player";
        }
        target.GetComponent <ObjectSpawner>().CreateFloatingStatusText("Blinded!", name + " has been blinded!");
    }
Пример #17
0
    public static void Lifeleech(Character attacker, Character target, float damage, AbilityAttribute attr)
    {
        var amount = damage * (float)attr.FindParameter("degree").value;

        attacker.GetComponent <Health>().Heal(amount);
        GameObject obj    = GameObject.Instantiate(attacker.GetComponent <CacheGrabber>().spellEffects[0]);
        var        script = obj.GetComponent <LifeleechScript>();

        script.vampire = attacker.transform;
        script.victim  = target.transform;
    }
Пример #18
0
 private void MaintainDamageEnemiesOnScreen(AbilityAttribute attribute)
 {
     if (GetComponent <PlayerCharacter>() != null)
     {
         foreach (var monster in Monster.monsters)
         {
             if (Vector3.Distance(transform.position, monster.transform.position) < 20f)
             {
                 monster.GetComponent <Health>().TakeDamage((float)attribute.FindParameter("degree").value *Time.deltaTime, Element.none, GetComponent <Character>(), silent: true);
             }
         }
     }
     else
     {
         foreach (var player in PlayerCharacter.players)
         {
             if (Vector3.Distance(transform.position, player.transform.position) < 20f)
             {
                 player.GetComponent <Health>().TakeDamage((float)attribute.FindParameter("degree").value *Time.deltaTime, Element.none, GetComponent <Character>(), silent: true);
             }
         }
     }
 }
Пример #19
0
    public static void Blunting(AttackAbility ability, Character attacker, Character target, AbilityAttribute attr)
    {
        float degree = (float)attr.FindParameter("degree").value;
        float multiplier;

        if (attacker.GetComponent <PlayerCharacter>() != null)
        {
            multiplier = attacker.GetComponent <PlayerCharacter>().weapon.attackPower;
        }
        else
        {
            multiplier = attacker.GetComponent <Monster>().attackFactor;
        }
        multiplier *= attacker.GetComponent <Attacker>().GetBaseDamage(ability.baseStat);
        target.GetComponent <StatusEffectHost>().AddStatusEffect("blunting", 60, degree * multiplier);
    }
Пример #20
0
    private static float GetElementalDamageBuff(UtilityAbility ability, AbilityAttribute attribute)
    {
        var damageBoost = (float)attribute.FindParameter("degree").value;

        if (damageBoost == 100)
        {
            return(140f);
        }
        else if (damageBoost == 50)
        {
            return(70f);
        }
        else
        {
            return(35);
        }
    }
Пример #21
0
    private static float GetInflictVulnerability(AttackAbility ability, AbilityAttribute attribute)
    {
        var degree = (float)attribute.FindParameter("degree").value;

        if (degree == 100)
        {
            return(ability.points * 0.75f);
        }
        else if (degree == 50)
        {
            return(ability.points * 0.5f);
        }
        else
        {
            return(ability.points * 0.25f);
        }
    }
Пример #22
0
    private static float GetElementalDamageBuff(AttackAbility ability, AbilityAttribute attribute)
    {
        var damageBoost = (float)attribute.FindParameter("degree").value;

        if (damageBoost == 100)
        {
            return(ability.points * 0.06f);
        }
        else if (damageBoost == 50)
        {
            return(ability.points * 0.03f);
        }
        else
        {
            return(ability.points * 0.01f);
        }
    }
    private static int BoostStatIcon(AbilityAttribute attribute)
    {
        var stat      = attribute.FindParameter("stat").value as string;
        var statTable = new Dictionary <string, int> {
            ["strength"]     = 74,
            ["dexterity"]    = 5,
            ["constitution"] = 48,
            ["intelligence"] = 55,
            ["wisdom"]       = 75,
            ["luck"]         = 76
        };

        if (statTable.ContainsKey(stat))
        {
            return(statTable[stat]);
        }
        else
        {
            return(0);
        }
    }
Пример #24
0
    public void AttrDisableDevice(ActiveAbility ability, AbilityAttribute attr)
    {
        var items = Physics.OverlapSphere(transform.position, (float)attr.FindParameter("radius").value);

        foreach (var item in items)
        {
            var lockedDoor = item.GetComponent <LockedDoor>();
            if (lockedDoor != null)
            {
                lockedDoor.Unlock(gameObject);
            }
            var lockedChest = item.GetComponent <LockedChest>();
            if (lockedChest != null)
            {
                lockedChest.Unlock(gameObject);
            }
            if (item.gameObject.CompareTag("TrapTrigger"))
            {
                GetComponent <AudioGenerator>().PlaySoundByName("sfx_trap_disarm");
                Destroy(item.gameObject);
            }
        }
    }
    private static int BoostElementalDamageIcon(AbilityAttribute attribute)
    {
        var element      = attribute.FindParameter("element").value as string;
        var elementTable = new Dictionary <string, int> {
            ["piercing"] = 26,
            ["slashing"] = 25,
            ["bashing"]  = 24,
            ["fire"]     = 28,
            ["ice"]      = 29,
            ["acid"]     = 27,
            ["light"]    = 30,
            ["dark"]     = 31
        };

        if (elementTable.ContainsKey(element))
        {
            return(elementTable[element]);
        }
        else
        {
            return(0);
        }
    }
Пример #26
0
    private static string ElementalDamageBuffSuffix(AbilityAttribute attribute)
    {
        var type     = attribute.FindParameter("element").value as string;
        var suffixes = new Dictionary <string, string> {
            ["bashing"]  = "of Achilles",
            ["piercing"] = "of Achilles",
            ["slashing"] = "of Achilles",
            ["fire"]     = "of the Inferno",
            ["ice"]      = "of Frostbite",
            ["acid"]     = "of Solvency",
            ["light"]    = "of Sunburn",
            ["dark"]     = "of the Voidgaze",
            ["none"]     = "of Nullity"
        };

        if (suffixes.ContainsKey(type))
        {
            return(suffixes[type]);
        }
        else
        {
            return("of ATTRIBUTE NAME NOT FOUND");
        }
    }
Пример #27
0
 public static void Delay(Character attacker, Character target, AttackAbility ability, float damage, AbilityAttribute attr)
 {
     target.GetComponent <StatusEffectHost>().AddStatusEffect("dde", (float)attr.FindParameter("time").value, degree: damage, inflicter: attacker, ability: ability);
 }
Пример #28
0
    public static void DamageShield(Character attacker, AttackAbility ability, AbilityAttribute attr)
    {
        var shieldAmount = (float)attr.FindParameter("degree").value *attacker.GetComponent <Attacker>().GetBaseDamage(ability.baseStat);

        attacker.GetComponent <StatusEffectHost>().AddStatusEffect("shield", 60f, degree: shieldAmount, good: true);
    }
Пример #29
0
 public static void RestoreMp(Character attacker, AbilityAttribute attr)
 {
     attacker.GetComponent <Mana>().mp = Mathf.Min(attacker.GetComponent <Mana>().mp + (float)attr.FindParameter("degree").value, attacker.GetComponent <Mana>().maxMP);
     attacker.GetComponent <ObjectSpawner>().CmdSpawnUnderParent(attacker.GetComponent <CacheGrabber>().spellEffects[10], attacker.gameObject);
 }
Пример #30
0
 public static void AddedDot(Character attacker, Character target, AttackAbility ability, AbilityAttribute attr)
 {
     target.GetComponent <StatusEffectHost>().AddStatusEffect("dot", (float)attr.FindParameter("duration").value, degree: attacker.GetComponent <Attacker>().GetBaseDamage(ability.baseStat) * (float)attr.FindParameter("degree").value / (float)attr.FindParameter("duration").value, inflicter: attacker, ability: ability);
 }