private int getFactor(ArmorShieldSpriteType type) { switch (type) { case ArmorShieldSpriteType.WalkFrame1: case ArmorShieldSpriteType.WalkFrame2: case ArmorShieldSpriteType.WalkFrame3: case ArmorShieldSpriteType.WalkFrame4: return(4); case ArmorShieldSpriteType.PunchFrame1: case ArmorShieldSpriteType.PunchFrame2: return(2); } return(1); }
private int GetOffsetBasedOnState(ArmorShieldSpriteType type) { switch (type) { case ArmorShieldSpriteType.WalkFrame1: case ArmorShieldSpriteType.WalkFrame2: case ArmorShieldSpriteType.WalkFrame3: case ArmorShieldSpriteType.WalkFrame4: return(4); case ArmorShieldSpriteType.PunchFrame1: case ArmorShieldSpriteType.PunchFrame2: return(2); } return(1); }
private int getFactor(ArmorShieldSpriteType type) { switch (type) { case ArmorShieldSpriteType.WalkFrame1: case ArmorShieldSpriteType.WalkFrame2: case ArmorShieldSpriteType.WalkFrame3: case ArmorShieldSpriteType.WalkFrame4: return 4; case ArmorShieldSpriteType.PunchFrame1: case ArmorShieldSpriteType.PunchFrame2: return 2; } return 1; }
public Texture2D GetShield(bool shieldIsOnBack) { //front shields have one size gfx, back arrows/wings have another size. ArmorShieldSpriteType type = ArmorShieldSpriteType.Standing; int factor; if (!shieldIsOnBack) { if (charRef.State == CharacterActionState.Walking) { switch (_data.walkFrame) { case 1: type = ArmorShieldSpriteType.WalkFrame1; break; case 2: type = ArmorShieldSpriteType.WalkFrame2; break; case 3: type = ArmorShieldSpriteType.WalkFrame3; break; case 4: type = ArmorShieldSpriteType.WalkFrame4; break; } } else if (charRef.State == CharacterActionState.Attacking) { switch (_data.attackFrame) { case 1: type = ArmorShieldSpriteType.PunchFrame1; break; case 2: type = ArmorShieldSpriteType.PunchFrame2; break; } } else if (charRef.State == CharacterActionState.SpellCast) { type = ArmorShieldSpriteType.SpellCast; } else { //hide shield graphic when sitting return(null); } factor = (_data.facing == EODirection.Down || _data.facing == EODirection.Right) ? 0 : 1; factor *= getFactor(type); } else { //sitting is valid for arrows and wings and bag //Standing = 1/2 //Attacking = 3/4 //Extra = 5 (unused?) if (charRef.State == CharacterActionState.Attacking && _data.attackFrame == 1) { type = (ArmorShieldSpriteType)3; } factor = (_data.facing == EODirection.Down || _data.facing == EODirection.Right) ? 0 : 1; } short baseShieldValue = (short)((_data.shield - 1) * 50); GFXTypes gfxFile = _data.gender == 0 ? GFXTypes.FemaleBack : GFXTypes.MaleBack; int gfxNumber = baseShieldValue + (int)type + factor; return(GFXLoader.TextureFromResource(gfxFile, gfxNumber, true)); }
public Texture2D GetArmor(bool isBow = false) { ArmorShieldSpriteType type = ArmorShieldSpriteType.Standing; switch (charRef.State) { case CharacterActionState.Walking: switch (_data.walkFrame) { case 1: type = ArmorShieldSpriteType.WalkFrame1; break; case 2: type = ArmorShieldSpriteType.WalkFrame2; break; case 3: type = ArmorShieldSpriteType.WalkFrame3; break; case 4: type = ArmorShieldSpriteType.WalkFrame4; break; } break; case CharacterActionState.Attacking: if (isBow) { switch (_data.attackFrame) { case 1: type = ArmorShieldSpriteType.Bow; break; case 2: type = ArmorShieldSpriteType.Standing; break; } } else { switch (_data.attackFrame) { case 1: type = ArmorShieldSpriteType.PunchFrame1; break; case 2: type = ArmorShieldSpriteType.PunchFrame2; break; } } break; case CharacterActionState.SpellCast: type = ArmorShieldSpriteType.SpellCast; break; case CharacterActionState.Sitting: switch (_data.sitting) { case SitState.Chair: type = ArmorShieldSpriteType.SitChair; break; case SitState.Floor: type = ArmorShieldSpriteType.SitGround; break; } break; } short baseArmorValue = (short)((_data.armor - 1) * 50); GFXTypes gfxFile = (_data.gender == 0) ? GFXTypes.FemaleArmor : GFXTypes.MaleArmor; int factor = (_data.facing == EODirection.Down || _data.facing == EODirection.Right) ? 0 : 1; //multiplier for the direction faced factor *= getFactor(type); int gfxNumber = baseArmorValue + (int)type + factor; return(GFXLoader.TextureFromResource(gfxFile, gfxNumber, true)); }