Commit f285997d authored by keyongyu's avatar keyongyu

多类型

parent 95f2a556
......@@ -6,6 +6,7 @@
*
*/
using System;
using System.Collections.Generic;
namespace DataEditorX.Core.Info
{
......@@ -14,56 +15,109 @@ namespace DataEditorX.Core.Info
/// </summary>
public enum CardType : long
{
///<summary>怪兽卡</summary>
///<summary>怪兽卡</summary>
TYPE_MONSTER =0x1 ,
///<summary>魔法卡</summary>
///<summary>魔法卡</summary>
TYPE_SPELL =0x2 ,
///<summary>陷阱卡</summary>
///<summary>陷阱卡</summary>
TYPE_TRAP =0x4 ,
///<summary>通常</summary>
///<summary>通常</summary>
TYPE_NORMAL =0x10 ,
///<summary>效果</summary>
///<summary>效果</summary>
TYPE_EFFECT =0x20 ,
///<summary>融合</summary>
///<summary>融合</summary>
TYPE_FUSION =0x40 ,
///<summary>仪式</summary>
///<summary>仪式</summary>
TYPE_RITUAL =0x80 ,
///<summary>陷阱怪兽</summary>
///<summary>陷阱怪兽</summary>
TYPE_TRAPMONSTER =0x100 ,
///<summary>灵魂</summary>
///<summary>灵魂</summary>
TYPE_SPIRIT =0x200 ,
///<summary>同盟</summary>
///<summary>同盟</summary>
TYPE_UNION =0x400 ,
///<summary>二重</summary>
///<summary>二重</summary>
TYPE_DUAL =0x800 ,
///<summary>调整</summary>
///<summary>调整</summary>
TYPE_TUNER =0x1000 ,
///<summary>同调</summary>
///<summary>同调</summary>
TYPE_SYNCHRO =0x2000 ,
///<summary>衍生物</summary>
///<summary>衍生物</summary>
TYPE_TOKEN =0x4000 ,
///<summary>速攻</summary>
///<summary>速攻</summary>
TYPE_QUICKPLAY =0x10000 ,
///<summary>永续</summary>
///<summary>永续</summary>
TYPE_CONTINUOUS =0x20000 ,
///<summary>装备</summary>
///<summary>装备</summary>
TYPE_EQUIP =0x40000 ,
///<summary>场地</summary>
///<summary>场地</summary>
TYPE_FIELD =0x80000 ,
///<summary>反击</summary>
///<summary>反击</summary>
TYPE_COUNTER =0x100000 ,
///<summary>反转</summary>
///<summary>反转</summary>
TYPE_FLIP =0x200000 ,
///<summary>卡通</summary>
///<summary>卡通</summary>
TYPE_TOON =0x400000 ,
///<summary>超量</summary>
///<summary>超量</summary>
TYPE_XYZ =0x800000 ,
///<summary>灵摆</summary>
///<summary>灵摆</summary>
TYPE_PENDULUM =0x1000000 ,
///<summary>特殊召唤</summary>
///<summary>特殊召唤</summary>
TYPE_SPSUMMON =0x2000000 ,
///<summary>连接</summary>
///<summary>连接</summary>
TYPE_LINK =0x4000000 ,
}
}
public static class CardTypes{
public static readonly CardType[] TYPE1 = {
CardType.TYPE_LINK,
CardType.TYPE_XYZ,
CardType.TYPE_SYNCHRO,
CardType.TYPE_PENDULUM,
CardType.TYPE_RITUAL,
CardType.TYPE_FUSION,
CardType.TYPE_SPIRIT,
CardType.TYPE_UNION,
CardType.TYPE_DUAL,
CardType.TYPE_FLIP,
CardType.TYPE_TOON,
};
public static readonly CardType[] TYPE2 = {
CardType.TYPE_PENDULUM,
CardType.TYPE_SYNCHRO,
CardType.TYPE_SPIRIT,
CardType.TYPE_UNION,
CardType.TYPE_DUAL,
CardType.TYPE_FLIP,
CardType.TYPE_TOON
};
public static readonly CardType[] TYPE3 ={
CardType.TYPE_TUNER,
CardType.TYPE_EFFECT
};
public static CardType[] GetMonsterTypes(long type){
var list = new List<CardType>(4);
var typeList=new List<CardType[]>(4);
typeList.Add(TYPE1);
typeList.Add(TYPE2);
typeList.Add(TYPE3);
typeList.Add(TYPE3);
typeList.Add(TYPE3);
int count = typeList.Count;
for(int i=0;i<count;i++){
CardType[] types = typeList[i];
foreach(var t in types){
if((type & (long)t)==(long)t){
if(!list.Contains(t)){
list.Add(t);
break;
}
}
}
}
return list.ToArray();
}
}
}
......@@ -277,105 +277,54 @@ public string GetType(CardType ctype)
public string[] GetTypes(Card c)
{
//卡片类型,效果1,效果2,效果3
string[] types = new string[] {
MseCardType.CARD_NORMAL, "", "", "", ""};
string[] types = {MseCardType.CARD_NORMAL, "", "", "", "",""};
if (c.IsType(CardType.TYPE_MONSTER))
{//卡片类型和第1效果
if(c.IsType(CardType.TYPE_LINK)){
types[0] = MseCardType.CARD_LINK;
}else if (c.IsType(CardType.TYPE_XYZ))
{
types[0] = MseCardType.CARD_XYZ;
types[1] = GetType(CardType.TYPE_XYZ);
}
else if (c.IsType(CardType.TYPE_TOKEN))
{
types[0] = (c.race == 0) ?
MseCardType.CARD_TOKEN2
: MseCardType.CARD_TOKEN;
types[1] = GetType(CardType.TYPE_TOKEN);
}
else if (c.IsType(CardType.TYPE_RITUAL))
{
types[0] = MseCardType.CARD_RITUAL;
types[1] = GetType(CardType.TYPE_RITUAL);
}
else if (c.IsType(CardType.TYPE_FUSION))
{
types[0] = MseCardType.CARD_FUSION;
types[1] = GetType(CardType.TYPE_FUSION);
}
else if (c.IsType(CardType.TYPE_SYNCHRO))
{
types[0] = MseCardType.CARD_SYNCHRO;
types[1] = GetType(CardType.TYPE_SYNCHRO);
}
else if (c.IsType(CardType.TYPE_EFFECT))
{
types[0] = MseCardType.CARD_EFFECT;
}
else
types[0] = MseCardType.CARD_NORMAL;
//同调
if (types[0] == MseCardType.CARD_SYNCHRO
|| types[0] == MseCardType.CARD_TOKEN)
{
if (c.IsType(CardType.TYPE_TUNER)
&& c.IsType(CardType.TYPE_EFFECT))
{//调整效果
types[2] = GetType(CardType.TYPE_TUNER);
types[3] = GetType(CardType.TYPE_EFFECT);
{
CardType[] cardTypes = CardTypes.GetMonsterTypes(c.type);
int count = cardTypes.Length;
for(int i=0; i<count && i<4; i++){
types[i+1] = GetType(cardTypes[i]);
}
if(cardTypes.Length>0){
if(c.IsType(CardType.TYPE_LINK)){
types[0] = MseCardType.CARD_LINK;
}else if (c.IsType(CardType.TYPE_XYZ))
{
types[0] = MseCardType.CARD_XYZ;
}
else if (c.IsType(CardType.TYPE_TUNER))
else if (c.IsType(CardType.TYPE_TOKEN))
{
types[2] = GetType(CardType.TYPE_TUNER);
types[0] = (c.race == 0) ?
MseCardType.CARD_TOKEN2
: MseCardType.CARD_TOKEN;
}
else if (c.IsType(CardType.TYPE_EFFECT))
else if (c.IsType(CardType.TYPE_RITUAL))
{
types[2] = GetType(CardType.TYPE_EFFECT);
types[0] = MseCardType.CARD_RITUAL;
}
}
else if (types[0] == MseCardType.CARD_NORMAL)
{
if (c.IsType(CardType.TYPE_PENDULUM))//灵摆
types[1] = GetType(CardType.TYPE_PENDULUM);
else if (c.IsType(CardType.TYPE_TUNER))//调整
types[1] = GetType(CardType.TYPE_TUNER);
}
else if (types[0] != MseCardType.CARD_EFFECT)
{//效果
if (c.IsType(CardType.TYPE_EFFECT))
types[2] = GetType(CardType.TYPE_EFFECT);
}
else
{//效果怪兽
types[2] = GetType(CardType.TYPE_EFFECT);
if (c.IsType(CardType.TYPE_PENDULUM))
types[1] = GetType(CardType.TYPE_PENDULUM);
else if (c.IsType(CardType.TYPE_TUNER))
types[1] = GetType(CardType.TYPE_TUNER);
else if (c.IsType(CardType.TYPE_SPIRIT))
types[1] = GetType(CardType.TYPE_SPIRIT);
else if (c.IsType(CardType.TYPE_TOON))
types[1] = GetType(CardType.TYPE_TOON);
else if (c.IsType(CardType.TYPE_UNION))
types[1] = GetType(CardType.TYPE_UNION);
else if (c.IsType(CardType.TYPE_DUAL))
types[1] = GetType(CardType.TYPE_DUAL);
else if (c.IsType(CardType.TYPE_FLIP))
types[1] = GetType(CardType.TYPE_FLIP);
else
else if (c.IsType(CardType.TYPE_FUSION))
{
types[1] = GetType(CardType.TYPE_EFFECT);
types[2] = "";
types[0] = MseCardType.CARD_FUSION;
}
else if (c.IsType(CardType.TYPE_SYNCHRO))
{
types[0] = MseCardType.CARD_SYNCHRO;
}
else if (c.IsType(CardType.TYPE_EFFECT))
{
types[0] = MseCardType.CARD_EFFECT;
}
else{
types[0] = MseCardType.CARD_NORMAL;
}
}
}
if (c.race == 0)//如果没有种族
{
types[1] = "";
types[2] = "";
types[3] = "";
types[4] = "";
}
return types;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment