Ejemplo n.º 1
0
    public override void ActorEffect(Combat combat, Actor source, TileNode center)
    {
        if (center.actorOnTile == null)
        {
            //This might cause problems
            //
            return;
        }

        Actor target = center.actorOnTile;

        if (target.ActorsController().PlayerControlled())
        {
            Debug.Log("");
        }

        CalculateChange(combat, source, target);

        foreach (AnimationData data in combat.animationDatas)
        {
            if (data.skillUsed.GetKey() == parentSkill)
            {
                ProcessTags(data.skillUsed.GetTags(), target.actorData.actorPropertyTags);
            }
        }
        //ProcessTags(combat.skillInUse.GetTags(), target.actorData.actorPropertyTags);

        HealthChangeCombatNode node = new HealthChangeCombatNode(source, center, target, deltaH);


        combat.actorDamageMap.Add(node);
    }
Ejemplo n.º 2
0
    void CalculateDamageScore(Combat testCombat, AIAction action)
    {
        int   unitHit = 0;
        float score   = 0;

        foreach (CombatNode cnode in testCombat.actorDamageMap)
        {
            if (cnode is HealthChangeCombatNode)
            {
                HealthChangeCombatNode node = (HealthChangeCombatNode)cnode;

                if (node.target != null)
                {
                    score = (node.target.GetCurrentStats(StatTypes.Health) + node.ChangeHealth) /
                            ((float)node.target.GetMaxStats(StatTypes.Health));

                    //This scoring system breaks with aoe abilities
                    //The last will determine the overall score
                    //we basically have to flip this idk it's dumb hopefully i explain latter
                    if (node.target.actorData.controller.PlayerControlled())
                    {
                        unitHit++;

                        score = (1 - score) + (unitHit * .1f);
                    }
                    else
                    {
                        //if an allied unit is hit, maybe we should subtract the number of units hit to asjust more accurately?

                        score = -.1f; // we'll just make it so that enemies try to never attack an ally
                    }

                    action.SetScore(score);
                }
                else
                {
                    // Debug.Log("node " + node.targetedTile.data.posX + ", " + node.targetedTile.data.posY + " didn't have any actor targets for some reason?");
                }
            }
        }
    }
Ejemplo n.º 3
0
    ///Should we also process the tags again for the drain effect?
    ///We just make this a toogle
    ///we could make toggle fors for swap, drain(always heal), invert(if a holy tagged thing actually damaged the undead tagged actor then the drain effect would heal the user)
    ///
    public override void ActorEffect(Combat combat, Actor source, TileNode target)
    {
        if (target.actorOnTile == null)
        {
            return;
        }

        base.ActorEffect(combat, source, target);

        int healthToHeal = deltaH;

        healthToHeal = Mathf.Abs(healthToHeal);



        TileNode tile = Globals.GetBoardManager().pathfinding.GetTileNode(source.GetPosX(), source.GetPosY());

        HealthChangeCombatNode node = new HealthChangeCombatNode(source, tile, source, healthToHeal);

        combat.actorDamageMap.Add(node);
    }