📄 aessedai.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.utils.*;
import wotlas.common.environment.*;
/** An Aes Sedai character.
*
* @author Aldiss, Diego
* @see wotlas.common.character.Female
*/
public class AesSedai extends Female {
/** id used in Serialized interface.
*/
private static final long serialVersionUID = 556565L;
/*------------------------------------------------------------------------------------*/
/** Ajah & Aes Sedai rank
*/
public final static String aesSedaiRank[][] = {
// Rank Name Rank Symbol
{ "Stilled", "stilled-11", },
{ "Novice", "novice-9", },
{ "Accepted", "accepted-8", },
{ "Blue Ajah", "blue-4", },
{ "Green Ajah", "green-5", },
{ "Yellow Ajah", "yellow-1", },
{ "Red Ajah", "red-3", },
{ "Brown Ajah", "brown-2", },
{ "White Ajah", "white-6", },
{ "Gray Ajah", "gray-7", },
{ "Keeper of the Chronicles", "keeper-10", },
{ "Amyrlin", "amyrlin-0", },
{ "Black Ajah", "black-12", },
};
/** Ajah & Aes Sedai rank
*/
public final static Color aesSedaiColor[] = {
// Rank Color
new Color(160,115,130),
Color.white,
Color.white,
new Color(119,152,213),
new Color(128,206,113),
new Color(209,203,99),
new Color(223,83,65),
new Color(180,158,80),
Color.white,
new Color(184,184,184),
new Color(230,220,240),
new Color(243,228,175),
Color.black,
};
/*------------------------------------------------------------------------------------*/
/** Aes Sedai status ( ajah, novice, accepted, amyrlin ). [PUBLIC INFO]
*/
private String characterRank;
/** Do we have to wear a black Ajah dress ? [PUBLIC INFO]
*/
private boolean blackAjah = false;
/*------------------------------------------------------------------------------------*/
/** Current Sprite.
*/
transient private Sprite aesSedaiSprite;
/** Current Shadow.
*/
transient private ShadowSprite aesSedaiShadowSprite;
/** Current Aura.
*/
transient private AuraEffect aesSedaiAuraEffect;
/** ColorImageFilter for InteriorMap Sprites.
*/
transient private ColorImageFilter filter;
/*------------------------------------------------------------------------------------*/
/** Constructor
*/
public AesSedai() {
InitCharData();
InitWotData();
classes[0] = CLASSES_WOT_AES_SEDAI;
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;
this.charAttributes[ATTR_MANA][IDX_MAX] = 100;
this.charAttributes[ATTR_MANA][IDX_ACTUAL] = 100;
}
/*------------------------------------------------------------------------------------*/
/** 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(aesSedaiSprite!=null)
return (Drawable) aesSedaiSprite;
// 1 - Sprite Creation + Filter
aesSedaiSprite = new Sprite( (SpriteDataSupplier) player, ImageLibRef.PLAYER_PRIORITY );
aesSedaiSprite.useAntialiasing(true);
updateColorFilter();
return aesSedaiSprite;
}
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(aesSedaiSprite==null)
return;
filter = new ColorImageFilter();
if(!blackAjah) {
if(characterRank.equals("Brown Ajah")) {
filter.addColorChangeKey( ColorImageFilter.blue, ColorImageFilter.brown );
}
else if(characterRank.equals("Blue Ajah")) {
// no filter needed
}
else if(characterRank.equals("Green Ajah")) {
filter.addColorChangeKey( ColorImageFilter.blue, ColorImageFilter.green );
}
else if(characterRank.equals("Red Ajah")) {
filter.addColorChangeKey( ColorImageFilter.blue, ColorImageFilter.red );
}
else if(characterRank.equals("Gray Ajah")) {
filter.addColorChangeKey( ColorImageFilter.blue, ColorImageFilter.gray );
}
else if(characterRank.equals("Yellow Ajah")) {
filter.addColorChangeKey( ColorImageFilter.blue, ColorImageFilter.yellow );
}
else
filter.addColorChangeKey( ColorImageFilter.blue, ColorImageFilter.white );
}
else
filter.addColorChangeKey( ColorImageFilter.blue, ColorImageFilter.darkgray ); // black dress
// 2 - Hair Color
if( hairColor.equals("brown") ) {
filter.addColorChangeKey( ColorImageFilter.yellow, ColorImageFilter.brown );
}
else if( hairColor.equals("black") ) {
filter.addColorChangeKey( ColorImageFilter.yellow, ColorImageFilter.darkgray );
}
else if( hairColor.equals("gray") ) {
filter.addColorChangeKey( ColorImageFilter.yellow, ColorImageFilter.gray );
}
else if( hairColor.equals("white") ) {
filter.addColorChangeKey( ColorImageFilter.yellow, ColorImageFilter.lightgray );
}
else if( hairColor.equals("reddish") ) {
filter.addColorChangeKey( ColorImageFilter.yellow, ColorImageFilter.red );
}
// 3 - Set Filter
aesSedaiSprite.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(aesSedaiShadowSprite!=null)
return (Drawable) aesSedaiShadowSprite;
// Shadow Creation
String path[] = { "players-0", "shadows-3", "aes-sedai-walking-0" };
aesSedaiShadowSprite = new ShadowSprite( aesSedaiSprite.getDataSupplier(),
new ImageIdentifier( path ),
ImageLibRef.SHADOW_PRIORITY, 4, 4 );
//aesSedaiShadowSprite.useAntialiasing(true);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -