public override void DoDamage(Tower t, int center, int damage, Tower self, int firingSection)
 {
     List<Section> sections = GetDamagedSections(t, center);
     if(sections.Count >= 1) {
         CombatLog.addLine("Hit section " + (center+1) + " for " + damage + " damage.");
     t.GetSection(center).attributes.material.GetSectionEffect().ApplyDamage(t.GetSection(center), damage);
     }else if(center < 0){
         CombatLog.addLine("Attack was too low");
         CombatLog.addLine("Fill the aim bar more.");
     } else if(center >= t.GetSections().Count) {
         CombatLog.addLine("Attack was too high");
         CombatLog.addLine("Lower the aim bar.");
     }
 }
Example #2
0
    public override List<Section> GetDamagedSections(Tower t, int center)
    {
        int ranNum1 = Random.Range(1, Mathf.RoundToInt(100/missPercentage) + 1);
        List<Section> list = new List<Section>();

        if (ranNum1 == 1)//If missed, miss
        {
            int ranNum2 = Random.Range(1, 3);
            CombatLog.addLine ("ran1 = " + ranNum1 + ". ran2 = " + ranNum2);
            if (ranNum2 == 1)//miss high
            {
                CombatLog.addLine("Miss Higher (blind)");
                if (center + 1 < t.GetHeight())//Missed above tower
                {
                    list.Add(t.GetSection(center+1));
                }
            }
            else//miss low
            {
                CombatLog.addLine("Miss Lower (blind)");
                if (center - 1 >= 0) //Missed below tower
                {
                    list.Add (t.GetSection(center - 1));
                }
            }
        }
        else{
                list.Add(t.GetSection(center));
            }
        return list;
    }
 private GUIStyle GetInspectorStyle(Tower t, int i, bool nada)
 {
     Section s = t.GetSection(i);
     GUIStyle gStyle;
     GUIStyle yStyle;
     GUIStyle rStyle;
     if(nada) {
         gStyle = nadagStyle;
         yStyle = nadayStyle;
         rStyle = nadarStyle;
     } else {
         bool hasWeapon = s.attributes.weapon.GetWeaponType() != "Nothing";
         gStyle = hasWeapon ? wgStyle : ngStyle;
         yStyle = hasWeapon ? wyStyle : nyStyle;
         rStyle = hasWeapon ? wrStyle : nrStyle;
     }
     int stress = t.GetWeightAboveSection(i);
     int maxSP = s.attributes.sp;
     double ratio = (double)stress / (double)maxSP;
     if(ratio < 0.33) {
         return gStyle;
     } else if(ratio >= 0.33 && ratio < 0.66) {
         return yStyle;
     } else {
         return rStyle;
     }
 }
Example #4
0
    public override void DoDamage(Tower t, int center, int damage, Tower self, int firingSection)
    {
        if(t.GetSections().Count >= 1) {
            //t.DamageSection(center, damage);
            Section s = t.GetSection (center);
            if (!modifiedSecs.ContainsKey(s)) //if not modified before...
            {
                ModifyWeight(s, t, damage, self);
                modifiedSecs.Add(s, 1);

            }
            else if (modifiedSecs[s] >= numTimesModifiable)
            {
                ModifyWeight(s, t, damage, self);
                modifiedSecs[s]++;
            }
            else
            {
                //TODO: Make this a warning and let them go back to their turn
                CombatLog.addLine("This section has already altered the weight " + modifiedSecs[s] + "times.");
            }
        }
        else if(center < 0) {
            CombatLog.addLine("Attack was too low");
            CombatLog.addLine("Fill the aim bar more.");
        } else if(center >= t.GetSections().Count) {
            CombatLog.addLine("Attack was too high");
            CombatLog.addLine("Lower the aim bar.");
        }
    }
 public override List<Section> GetDamagedSections(Tower t, int center)
 {
     List<Section> list = new List<Section>();
     if(center >= 0 && center < t.GetSections().Count) {
         list.Add(t.GetSection(center));
     }
     return list;
 }
Example #6
0
 public void Heal(int damage, int center, Tower t)
 {
     int heal = (damage*drainPercentage)/100; //40 percent
     Section s = t.GetSection(center);
     if (s.attributes.maxSP >= s.attributes.sp + heal){
         s.attributes.sp += heal;
     }
     else
         s.attributes.sp += (s.attributes.material.GetInitialSP() - s.attributes.sp);
 }
Example #7
0
 public override void DoDamage(Tower t, int center, int damage, Tower self, int firingSec)
 {
     List<Section> sections = GetDamagedSections(t, center);
     if(sections.Count >= 1) {
         Section section = sections[0];
         CombatLog.addLine("Hit section " + (section.attributes.height + 1) + " for " + damage + " damage.");
         //t.DamageSection(center, damage);
         section.attributes.material.GetSectionEffect().ApplyDamage(section, damage);
     } else if(center < 0) {
         CombatLog.addLine("Attack was too low");
     } else if(center >= t.GetSections().Count) {
         CombatLog.addLine("Attack was too high");
     }
     numAttacks--;
     if (numAttacks <= 0)
     {
         self.GetSection(firingSec).attributes.weapon.SetWeaponEffect(new DefaultWeaponEffect(self.GetSection(firingSec).attributes.weapon));
         Destruct();
     }
 }
Example #8
0
 public override List<Section> GetDamagedSections(Tower t, int center)
 {
     int down = numTargets[upgradeLevel]/2;
     int up = down;
     down = numTargets[upgradeLevel]%2 == 0 ? down-1 : down;
     int start = center - down;
     if(start < 0) {
         start = 0;
     }
     int end = center + up;
     if(end >= t.GetSections().Count) {
         end = t.GetSections().Count - 1;
     }
     Debug.Log("Start: " + start + " End: " + end);
     List<Section> list = new List<Section>();
     if(end >= 0) {
         for(int i=start; i <= end; i++) {
             list.Add(t.GetSection(i));
         }
     }
     return list;
 }
Example #9
0
 public override void DoDamage(Tower t, int center, int damage, Tower self, int firingSection)
 {
     if(t.GetSections().Count >= 1) {
         //t.DamageSection(center, damage);
         Section s = t.GetSection (center);
         SectionEffect eff = s.attributes.material.GetSectionEffect();
         eff.ApplyDamage(s, damage);
         if (s.attributes.HasWeapon())
         {
             if (s.attributes.weapon.GetEffect().GetEffectType() != "Blinded")
             {
                 s.attributes.weapon.GetEffect().Destruct();
                 s.attributes.weapon.SetWeaponEffect(new Blinded(missChance, s.attributes.weapon, s));
             }
         }
     }
     else if(center < 0) {
         CombatLog.addLine("Attack was too low");
     } else if(center >= t.GetSections().Count) {
         CombatLog.addLine("Attack was too high");
     }
 }
Example #10
0
    public override void DoDamage(Tower t, int center, int damage, Tower self, int firingSection)
    {
        if(t.GetSections().Count >= 1) {
            //t.DamageSection(center, damage);
            Section s = t.GetSection (center);
            SectionEffect eff = s.attributes.material.GetSectionEffect();
            eff.ApplyDamage(s, damage);
            if (eff.GetEffectType() != "Tagged")
            {
                s.attributes.material.GetSectionEffect().Destruct();
                s.attributes.material.SetSectionEffect(new Tagged(critStrikeDamageModifier, s));
            }

        }
        else if(center < 0) {
            CombatLog.addLine("Attack was too low");
            CombatLog.addLine("Fill the aim bar more.");
        } else if(center >= t.GetSections().Count) {
            CombatLog.addLine("Attack was too high");
            CombatLog.addLine("Lower the aim bar.");
        }
    }
Example #11
0
    public override void DoDamage(Tower t, int center, int damage, Tower self, int firingSec)
    {
        List<Section> sections = GetDamagedSections(self, firingSec);
        if(sections.Count >= 1) {
            CombatLog.addLine("Hit section " + (center+1) + " for " + damage + " damage.");
            //t.DamageSection(center, damage);
            t.GetSection (center).attributes.material.GetSectionEffect().ApplyDamage(t.GetSection(center), damage);

            if (t.GetSection(center).attributes.HasWeapon()){
                CombatLog.addLine("Section is confused");
                t.GetSection(center).attributes.material.GetSectionEffect().Destruct();
                t.GetSection(center).attributes.material.SetSectionEffect(new Poisoned(t.GetSection(center)));
            }
        }
        else if(center < 0) {
            CombatLog.addLine("Attack was too low");
            CombatLog.addLine("Fill the aim bar more.");
        } else if(center >= t.GetSections().Count) {
            CombatLog.addLine("Attack was too high");
            CombatLog.addLine("Lower the aim bar.");
        }
    }
Example #12
0
 public override List<Section> GetDamagedSections(Tower t, int center)
 {
     List<Section> secs = new List<Section>();
     secs.Add(t.GetSection(center));
     return secs;
 }
Example #13
0
 public void Stun(Tower t, int center)
 {
     Section s = t.GetSection(center);
     s.attributes.weapon.fire = false;
     CombatLog.addLine("Weapon is stunned.  It won't deal damage until it is repaired.");
 }
Example #14
0
    private void SelectSection(Tower t, int sectionNumber)
    {
        //Debug.Log ("Section Selected");
        InGameCamera mc = GameObject.FindWithTag("MainCamera").GetComponent<InGameCamera>();
        if(selectedSection != null) {
            selectedSection.Unhighlight();
        }
        if(selectedTower != null) {
            selectedTower.towerBase.Unhighlight();
        }
        if(sectionNumber < 0) {
            selectedSection = null;
            ValueStore.selectedMaterial = null; //For Fortify Menu Update
            if(!disableCameraPan) {
                mc.ChangeTarget(t.towerBase.transform);
            }
            t.towerBase.Highlight();

            //mc.SetCurrentTower(t);	//Allows camera to hold tower info
        } else {
            Section s = t.GetSection(sectionNumber);
            selectedSection = s;
            ValueStore.selectedMaterial = s.attributes.material; //For Fortify Menu Update
            if(!disableCameraPan) {
                mc.ChangeTarget(s.transform);
            }
            s.Highlight();
        }
        selectedTower = t;
    }