Ejemplo n.º 1
0
    protected StatValue ModifedValue(float value, string stat, CharacterValueContainer parent)
    {
        StatValue val = parent.DataHandler.CopyStat(stat);

        val.AddModifier(new ValueModifier(value, ValueModEnum.Flat));
        return(val);
    }
Ejemplo n.º 2
0
 public bool CanCast(CharacterValueContainer container)
 {
     if (cooldown.CurrentValue < cooldown.MaxValue)
     {
         return(false);
     }
     builder.CanCast(container);
     return(true);
 }
Ejemplo n.º 3
0
    public override PreparedAction ReturnPreparedAction(CharacterValueContainer container)
    {
        float actionDuration = ModifedValue(_preparedbehaviour.actionDuration, Stats.SkillDuration.ToString(), container).TotalValue;
        float actionSpeed    = ModifedValue(_preparedbehaviour.actionSpeed, Stats.ProjectileSpeed.ToString(), container).TotalValue;
        NumAffectedTargets      numTargets = _preparedbehaviour.targetsHitToDestroy;
        PreparedActionBehaviour behaviour  = new PreparedActionBehaviour(actionDuration, actionSpeed, numTargets);
        PreparedAction          action     = new PreparedAction(behaviour);
        DamageAction            dam        = CreateDamageAction();

        action.AddAction(dam);
        return(action);
    }
Ejemplo n.º 4
0
    public Stats scaleStat = Stats.PhysicalDamage; //attribute? stat enum?)


    //set cooldown
    //set resourcecosts


    //add in use, travel and hit FX
    //add in components (with values calculated from passed in users stats


    //conceptually, these are good methods, but the implementation of retrieving stats is sloppy and verbose, needs to be smoother
    public override HotbarActionBehaviour ReturnHotbarBehaviour(CharacterValueContainer container)
    {
        HotbarActionBehaviour behaviour = new HotbarActionBehaviour();

        behaviour.baseChargeTime = ModifedValue(_hotBarBehaviour.baseChargeTime, Stats.ChargeReduction.ToString(), container).TotalValue;

        behaviour.actionLock = ModifedValue(_hotBarBehaviour.actionLock, Stats.ActionLockScale.ToString(), container).TotalValue;

        behaviour.actionCooldown  = ModifedValue(_hotBarBehaviour.actionCooldown, Stats.CurrentCooldownReduction.ToString(), container).TotalValue;
        behaviour.canCharge       = _hotBarBehaviour.canCharge;
        behaviour.chargeMoveSpeed = ModifedValue(_hotBarBehaviour.chargeMoveSpeed, Stats.ChargeMoveSpeedIncrease.ToString(), container).TotalValue;

        behaviour.ResourceCosts = _hotBarBehaviour.ResourceCosts;
        foreach (var item in behaviour.ResourceCosts)
        {
            item.Amount = ModifedValue(item.Amount, Stats.CostReduction.ToString(), container).TotalValue;
        }
        return(behaviour);
    }
Ejemplo n.º 5
0
    [SerializeField, TextArea(1, 30)] protected string toolTip; // not public, use ToolTip()
    public virtual string ToolTip(CharacterValueContainer parent, int level)
    {
        StringBuilder tip = new StringBuilder(toolTip);

        tip.Replace("{NAME}", name);
        tip.Replace("{LEVEL}", level.ToString());
        //tip.Replace("{ACTIONLOCK}", InterfaceUtils.PrettySeconds(ModifedValue(_hotBarBehaviour.actionLock, Stats.ActionLockScale.ToString(), parent).TotalValue));
        tip.Replace("{ACTIONLOCK}", InterfaceUtils.PrettySeconds(_hotBarBehaviour.actionLock));
        //tip.Replace("{COOLDOWN}", InterfaceUtils.PrettySeconds(ModifedValue(_hotBarBehaviour.actionCooldown, Stats.CurrentCooldownReduction.ToString(), parent).TotalValue));        //tip.Replace("{ACTIONLOCK}", InterfaceUtils.PrettySeconds(ModifedValue(_hotBarBehaviour.actionLock, Stats.ActionLockScale.ToString(), parent).TotalValue));
        tip.Replace("{COOLDOWN}", InterfaceUtils.PrettySeconds(_hotBarBehaviour.actionCooldown));
        //tip.Replace("{CASTRANGE}", castRange.Get(level).ToString());
        foreach (var cost in _hotBarBehaviour.ResourceCosts)
        {
            tip.Replace("{COST}", cost.Amount.ToString());
            tip.Replace("{TYPE}", cost.type.ToString());
            tip.Replace("{RESOURCE}", cost.resource.ToString());
        }

        return(tip.ToString());
    }
Ejemplo n.º 6
0
    public bool CanCast(CharacterValueContainer parent)
    {
        foreach (var item in _hotBarBehaviour.ResourceCosts)
        {
            float val = 0;
            var   cur = parent.DataHandler.RetrieveResourceData(item.resource);
            switch (item.type)
            {
            case CostType.PercentCurrent:
                val = (item.Amount / 100) * cur.CurrentValue;
                break;

            case CostType.PercentMaximum:
                val = (item.Amount / 100) * cur.MaxValue;
                break;

            case CostType.PercentMissing:
                val = (item.Amount / 100) * cur.MissingValue;
                break;

            case CostType.Flat:
                val = item.Amount;
                break;

            default:
                break;
            }
            if (val > cur.CurrentValue)
            {
                return(false);
            }
        }
        return(true);

        //return true only if the user can afford to cast the skill and its off cooldown
    }
Ejemplo n.º 7
0
 public virtual PreparedAction ReturnPreparedAction(CharacterValueContainer container)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 8
0
 public virtual HotbarActionBehaviour ReturnHotbarBehaviour(CharacterValueContainer container)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 9
0
 public PreparedAction Action(CharacterValueContainer container)
 {
     //cache it?
     return(builder.ReturnPreparedAction(container));
 }
Ejemplo n.º 10
0
 public HotbarActionBehaviour Behaviour(CharacterValueContainer container)
 {
     //cache it?
     return(builder.ReturnHotbarBehaviour(container));
 }