diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java index b4d5e478a..dfa241c1b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java @@ -50,8 +50,6 @@ public class Messages { return lang; } - - /** * Setup Methods */ @@ -170,10 +168,8 @@ public class Messages { //Words which should not be capitalized in title case, mostly prepositions which appear ingame //This list is not comprehensive! private static final HashSet noCaps = new HashSet<>( - Arrays.asList(new String[]{ - //English - "a", "an", "and", "of", "by", "to", "the", "x" - }) + Arrays.asList(//English + "a", "an", "and", "of", "by", "to", "the", "x") ); public static String titleCase( String str ){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java index c4006a6d9..0020fbc46 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java @@ -73,6 +73,55 @@ public class WndInfoItem extends Window { layoutFields(item, iconTitle, PixelScene.renderTextBlock(item.info(), 6)); } + boolean isMatch(String customName) { + String[] matchArray = { + // 水果 Fruit + "Apple", "Banana", "Orange", "Grape", "Watermelon", "Strawberry", "Mango", "Peach", "Pineapple", "Pear", + + // 动物 Animal + "Bear", "Beaver", "Bee", "Bird", "Butterfly", "Cat", "Chicken", "Cow", "Crocodile", + "Deer", "Dog", "Dolphin", "Duck", "Eagle", "Elephant", "Fish", "Fox", "Frog", "Giraffe", + "Goat", "Gorilla", "Hamster", "Hippopotamus", "Horse", "Jaguar", "Kangaroo", "Koala", "Leopard", + "Lion", "Lobster", "Monkey", "Mosquito", "Mouse", "Octopus", "Owl", "Panda", "Panther", "Parrot", + "Pelican", "Penguin", "Pig", "Pigeon", "Pike", "Rabbit", "Rat", "Rhinoceros", "Rooster", "Seagull", + "Shark", "Sheep", "Snail", "Snake", "Spider", "Squirrel", "Swan", "Tiger", "Turtle", "Walrus", + "Whale", "Wolf", "Zebra", + + // 花卉 Flower + "Rose", "Lily", "Daisy", "Sunflower", "Tulip", "Orchid", "Carnation", "Hyacinth", "Peony", "Chrysanthemum", + + // 运动器材 Sport Equipment + "Basketball", "Football", "Soccer", "Tennis", "Table Tennis", "Badminton", "Swimming", "Running", "Cycling", "Hiking", + + // 学科 Subject + "Mathematics", "Physics", "Chemistry", "Biology", "History", "Geography", "English", "Chinese", "Art", "Music", + + // 家具 Furniture + "Chair", "Table", "Bed", "Wardrobe", "Sofa", "Armchair", "Bookshelf", "Coffee Table", "Dining Table", "Desk", + + // 电器 Appliance + "Television", "Refrigerator", "Washing Machine", "Air Conditioner", "Microwave Oven", "Vacuum Cleaner", "Water Heater", "Hair Dryer", "Electric Fan", "Lamp", + + // 自然地理 Nature + "Forest", "Mountain", "River", "Lake", "Beach", "Desert", "Jungle", "Grassland", "Island", "Volcano", + + // 职业 Occupation + "Doctor", "Nurse", "Teacher", "Engineer", "Lawyer", "Writer", "Actor", "Singer", "Chef", "Scientist", + + // 学习用品 Stationery + "Pencil", "Pen", "Eraser", "Ruler", "Scissors", "Tape", "Glue", "Calculator", "Notebook", "Highlighter" + }; + + //忽略首尾空格 忽略大小写判定 + customName = customName.trim().toLowerCase(); + for (String str : matchArray) { + if (str.toLowerCase().equals(customName)) { + return true; + } + } + return false; + } + private void layoutFields(Item item, IconTitle iconTitle, RenderedTextBlock renderedTextBlock) { int i = 120; renderedTextBlock.maxWidth(120); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndUseItem.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndUseItem.java index 313eaf3d3..0868862d3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndUseItem.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndUseItem.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.ui.IconButton; @@ -35,7 +36,9 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.InventoryPane; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.Image; +import com.watabou.utils.Random; import java.util.ArrayList; @@ -108,6 +111,10 @@ public class WndUseItem extends WndInfoItem { if (name) { if (item instanceof EquipableItem) { ((EquipableItem) item).customName = str; + if (!(item instanceof Weapon) || isMatch(((Weapon)item).customName)) { + item.level(Random.Int(2, 4)); + GLog.b("拼写正确!该武器名称为 " + item.name() + ",等级为 " + item.level() + "。"); + } } else { ((Wand) item).customName = str; }