Android Open Source - rpg-droid Armor Class






From Project

Back to project page rpg-droid.

License

The source code is released under:

Apache License

If you think the Android project rpg-droid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.thing.rpg_droid.pathfinder;
// ww  w  .ja v  a 2s  . c  o m
/**
 * Created by jon on 14/06/14.
 */
public class ArmorClass {
    public enum AttackType {Normal, Touch, FlatFooted}

    private int mNaturalArmor = 0;

    private int mMiscModifier = 0;

    private Character mCharacter = null;

    public ArmorClass(Character pCharacter)
    {
        mCharacter = pCharacter;
    }

    public int getArmorBonus()
    {
        return 0;
        //TODO scrape equipped gear for armor bonus
    }

    public int getShieldBonus()
    {
        return 0;
        //TODO scrape equipped gear for shield bonus
    }

    public int getDexModifier()
    {
        return mCharacter.getAbility(Ability.AbilityName.DEX).getCurrentModifier();
    }

    public int getSizeModifier()
    {
        return - mCharacter.getSize().getValue();
    }

    public int getNaturalArmor()
    {
        return mNaturalArmor;
    }

    public void setNaturalArmor(int pValue)
    {
        mNaturalArmor = pValue;
    }

    public int getDeflectionModifier()
    {
        return 0;
        //TODO scrape gear and active spells for deflection
    }

    public int getMiscModifier()
    {
        return mMiscModifier;
    }

    public void setMiscModifier(int pValue)
    {
        mMiscModifier = pValue;
    }

    public int getAC(AttackType pType)
    {
        //TODO dodge bonus??

        switch (pType)
        {
            case Touch:
                return 10 + getDexModifier() + getSizeModifier() + getDeflectionModifier() + getMiscModifier();
            case FlatFooted:
                return 10 + getArmorBonus() + Math.min(getDexModifier(), 0) + getSizeModifier() + getNaturalArmor() +
                        getDeflectionModifier() + getMiscModifier();
            default:
                return 10 + getArmorBonus() + getShieldBonus() + getDexModifier() + getSizeModifier() + getNaturalArmor() +
                        getDeflectionModifier() + getMiscModifier();
        }
    }
}




Java Source Code List

com.thing.rpg_droid.Utils.DieRoller.java
com.thing.rpg_droid.Utils.DieType.java
com.thing.rpg_droid.app.Activity_CharacterList.java
com.thing.rpg_droid.app.Activity_Charsheet.java
com.thing.rpg_droid.app.CharSheet_PageInfo.java
com.thing.rpg_droid.app.Fragment_CharacterList.java
com.thing.rpg_droid.app.ICharacter.java
com.thing.rpg_droid.app.PagerAdapter_Charsheet.java
com.thing.rpg_droid.app.ViewBinder.java
com.thing.rpg_droid.app.View_CharacterSheet_Field.java
com.thing.rpg_droid.app.dummy.DummyContent.java
com.thing.rpg_droid.pathfinder.Ability.java
com.thing.rpg_droid.pathfinder.Adapters.java
com.thing.rpg_droid.pathfinder.Appearance.java
com.thing.rpg_droid.pathfinder.ArmorClass.java
com.thing.rpg_droid.pathfinder.BodySlot.java
com.thing.rpg_droid.pathfinder.Character.java
com.thing.rpg_droid.pathfinder.Fragment_Basic.java
com.thing.rpg_droid.pathfinder.Fragment_Gear.java
com.thing.rpg_droid.pathfinder.Fragment_Skills.java
com.thing.rpg_droid.pathfinder.Fragment_Spells_Abilities.java
com.thing.rpg_droid.pathfinder.Fragment_Status.java
com.thing.rpg_droid.pathfinder.IInventoryLocation.java
com.thing.rpg_droid.pathfinder.Initiative.java
com.thing.rpg_droid.pathfinder.SavingThrow.java
com.thing.rpg_droid.pathfinder.SizeModifier.java
com.thing.rpg_droid.pathfinder.Skill.java
com.thing.rpg_droid.pathfinder.Spell.java
com.thing.rpg_droid.pathfinder.Status.java