⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 weaponwrath.java

📁 JAVA 工厂方法
💻 JAVA
字号:
package org.su.demo.forge.items.Weapon;

import org.su.demo.forge.factory.CityIngredientFactory;

/*
 * 继承自武器的抽象基类
 * 锻造-雷霆-
 */
public class WeaponWrath extends Weapon {
	CityIngredientFactory cityIngredientFactory;
	//构造函数中取得一个工厂并储存到一个实例变量中
	public WeaponWrath(CityIngredientFactory cityIngredientFactory)
	{
		this.cityIngredientFactory = cityIngredientFactory; 
	}

	@Override
	public void prepare() {
		//从材料工厂得到正确的材料
		//雷霆需要3种材料
		this.ore = cityIngredientFactory.createOre();
		this.primal = cityIngredientFactory.createPrimal();
		this.potion =  cityIngredientFactory.createPotion();
		this.weaponName = "雷霆";
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -