📄 ashaman.java
字号:
/*
* Light And Shadow. A Persistent Universe based on Robert Jordan's Wheel of Time Books.
* Copyright (C) 2001-2003 WOTLAS Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package wotlas.common.character;
import java.io.*;
import java.awt.Color;
import wotlas.common.*;
import wotlas.common.universe.*;
import wotlas.common.objects.inventories.*;
import wotlas.libs.graphics2D.*;
import wotlas.libs.graphics2D.drawable.*;
import wotlas.libs.graphics2D.filter.*;
import wotlas.common.environment.*;
/** A Ashaman character.
*
* @author Aldiss, Elann, Diego
* @see wotlas.common.character.Male
*/
public class Ashaman extends Male {
/** id used in Serialized interface.
*/
private static final long serialVersionUID = 556565L;
/*------------------------------------------------------------------------------------*/
/** Ashaman rank
*/
public final static String ashamanRank[][] = {
// Rank Name Rank Symbol
{ "Soldier", "soldier-0", },
{ "Dedicated", "dedicated-1", },
{ "Asha'man", "ashaman-2", },
{ "M'Hael", "mhael-3", },
};
/** Ashaman rank
*/
public final static Color ashamanColor[] = {
// Rank Color
Color.white,
new Color(184,184,184),
new Color(100,100,100),
new Color(10,10,10),
};
/*------------------------------------------------------------------------------------*/
/** Ashaman status ( soldier, ... ). [PUBLIC INFO]
*/
private String characterRank;
/*------------------------------------------------------------------------------------*/
/** Current Sprite.
*/
transient private Sprite ashamanSprite;
/** Current Shadow.
*/
transient private ShadowSprite ashamanShadowSprite;
/** Current Aura.
*/
transient private AuraEffect ashamanAuraEffect;
/** ColorImageFilter for InteriorMap Sprites.
*/
transient private ColorImageFilter filter;
/*------------------------------------------------------------------------------------*/
/** Constructor
*/
public Ashaman() {
InitCharData();
InitWotData();
classes[0] = CLASSES_WOT_ASHAMAN;
this.charAttributes[this.ATTR_STR][this.IDX_ACTUAL] = 10;
this.charAttributes[this.ATTR_STR][this.IDX_MAX] = 10;
this.charAttributes[this.ATTR_INT][this.IDX_ACTUAL] = 10;
this.charAttributes[this.ATTR_INT][this.IDX_MAX] = 10;
this.charAttributes[this.ATTR_WIS][this.IDX_ACTUAL] = 10;
this.charAttributes[this.ATTR_WIS][this.IDX_MAX] = 10;
this.charAttributes[this.ATTR_CON][this.IDX_ACTUAL] = 10;
this.charAttributes[this.ATTR_CON][this.IDX_MAX] = 10;
this.charAttributes[this.ATTR_DEX][this.IDX_ACTUAL] = 10;
this.charAttributes[this.ATTR_DEX][this.IDX_MAX] = 10;
this.charAttributes[this.ATTR_CHA][this.IDX_ACTUAL] = 10;
this.charAttributes[this.ATTR_CHA][this.IDX_MAX] = 10;
}
/*------------------------------------------------------------------------------------*/
/** To get a Drawable for this character. This should not be used on the
* server side.
*
* The returned Drawable is unique : we always return the same drawable per
* AesSedai instance.
*
* @param player the player to chain the drawable to. If a XXXDataSupplier is needed
* we sets it to this player object.
* @return a Drawable for this character.
*/
public Drawable getDrawable( Player player ) {
if( !player.getLocation().isTileMap() ){
if(ashamanSprite!=null)
return (Drawable) ashamanSprite;
// 1 - Sprite Creation + Filter
ashamanSprite = new Sprite( (SpriteDataSupplier) player, ImageLibRef.PLAYER_PRIORITY );
ashamanSprite.useAntialiasing(true);
updateColorFilter();
return ashamanSprite;
}
else {
if(fakeSprite!=null)
return (Drawable) fakeSprite;
int imageNr = 0;
switch( EnvironmentManager.whtGraphicSetIs() ){
case EnvironmentManager.GRAPHICS_SET_ROGUE:
imageNr = 0;
break;
default:
imageNr = EnvironmentManager.getDefaultNpcImageNr();
}
fakeSprite = new FakeSprite( (FakeSpriteDataSupplier) player, ImageLibRef.PLAYER_PRIORITY
, EnvironmentManager.getServerEnvironment().getGraphics(EnvironmentManager.SET_OF_NPC
)[ EnvironmentManager.getDefaultPlayerImage() ], imageNr );
return fakeSprite;
}
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/** Updates the color filter that is used for the AesSedai sprite.
*/
private void updateColorFilter() {
if(ashamanSprite==null)
return;
filter = new ColorImageFilter();
// 2 - Hair Color
if( hairColor.equals("brown") ) {
filter.addColorChangeKey( ColorImageFilter.lightYellow, ColorImageFilter.brown );
}
else if( hairColor.equals("black") ) {
filter.addColorChangeKey( ColorImageFilter.lightYellow, ColorImageFilter.darkgray );
}
else if( hairColor.equals("gray") ) {
filter.addColorChangeKey( ColorImageFilter.lightYellow, ColorImageFilter.gray );
}
else if( hairColor.equals("white") ) {
filter.addColorChangeKey( ColorImageFilter.lightYellow, ColorImageFilter.lightgray );
}
else if( hairColor.equals("reddish") ) {
filter.addColorChangeKey( ColorImageFilter.lightYellow, ColorImageFilter.red );
}
else if( hairColor.equals("golden") ) {
filter.addColorChangeKey( ColorImageFilter.lightYellow, ColorImageFilter.yellow );
}
// 3 - Set Filter
ashamanSprite.setDynamicImageFilter( filter );
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/** Return the character's shadow. Important: a character Drawable MUST have been created
* previously ( via a getDrawable call ). You don't want to create a shadow with no
* character, do you ?
*
* @return character's Shadow Drawable.
*/
public Drawable getShadow(){
if(ashamanShadowSprite!=null)
return (Drawable) ashamanShadowSprite;
// Shadow Creation
String path = null;
path = "players-0/shadows-3/guard-walking-2"; // same shadow as the tower guard
ashamanShadowSprite = new ShadowSprite( ashamanSprite.getDataSupplier(),
new ImageIdentifier( path ),
ImageLibRef.SHADOW_PRIORITY, 4, 4 );
return ashamanShadowSprite;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -