c16r/yugioh-pegasus-castle-sprint 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

c16r/yugioh-pegasus-castle-sprint

Composer 安装命令:

composer require c16r/yugioh-pegasus-castle-sprint

包简介

A breakdown of the Yu-Gi-Oh Pegasus' Castle Sprint board game

README 文档

README

A simple package to compare different decks of cards in the board game Pegasus' Castle Sprint

Creating a Deck.

Creating a Deck uses the Chestersa\Yugioh\Deck class,

Initialising a Deck

$deck = new Deck('Name');

This will create a new deck with the name set to whatever you've passed into the constructor, names are used when outputting results between 2 decks.

$deck->getName();

Will then return the deck's name to use elsewhere

Adding Cards

Then there are two ways to add a new card:

$deck->addCard($name, $atk, $type);
$deck->addCard('Dark Magician', 2500, Chestersa\Yugioh\Field::$DARK);

Where $name is the name of the card, $atk is the card's attack level, and $type is the card's field type, there are constants defined for this in the Chestersa\Yugioh\Field class which will be explained later, but you can use any values.

To bulk add cards you can use the addCards method:

$deck->addCards([
  ['name' => 'Dark Magician', 'atk' => 2500, 'type' => Chestersa\Yugioh\Field::$DARK]
]);

The keys for name, atk, and type are all required and should be the same as for the addCard method

Dealing with Wins

Each deck will have a wins property set to 0 when it is initialised, which will be increased whenever it wins a head-to-head contest with another

$deck->addWin()

will increase the wins by one

$deck->getWins()

will return the current wins for the deck

Creating a field.

The field in this game is created of tokens for different field locations, which can double a monster's attack if the field types match.

All field objects use the Chestersa\Yugioh\Field which has constants for the 5 field types used in the game

Field::$NIGHT
Field::$DAY
Field::$GRASS
Field::$FOREST
Field::$WATER

Creating a field

$field = new Field();

Adding to Fields

$field->addToField($type, $amount);

Where $type is the key of the field type and $amount is how many to add, defaults to 1

To make things easier there are 5 helpers functions, one for each default field type:

$field->addNight($amount)
$field->addDay($amount)
$field->addGrass($amount)
$field->addForest($amount)
$field->addWater($amount)

Retrieving a Field

To retrieve the field setup use:

$field->getField();

Comparing Decks

Setup

To compare the decks, use the Chestersa\Yugioh\YuGiOh class

To initialise a simulation first of all you need to set the Field:

YuGiOh::setField($field)

where $field is a Field object

Then you can compare 2 deck using:

YuGiOh::compareDecks($deck1, $deck2)

Which returns a string with the outputs and if $deck1 wins more than it loses, its Wins property will be incremented by 1.

Comparing multiple at a time

To compare multiple character decks use the helper:

YuGiOh::runSimulation([$deck1, $deck2, $deck3, $deck4]);

Which will run every deck in the array against all the others and return an array with all of the output strings.

Comparing multiple to the opponents

To compare multiple character decks to the opponent deck at the same time use the helper:

YuGiOh::runVsOpponents([$deck1, $deck2, $deck3, $deck4], $opponents);

Which will run every deck in the array against the opponents and return an array of the output strings.

The YuGiOhFactory

There is a Chestersa\Yugioh\YuGiOhFactory class with helpers to get all the decks and field setup as in the base board game:

YuGiOhFactory::getYugisDeck();
YuGiOhFactory::getKaibasDeck();
YuGiOhFactory::getJoeysDeck();
YuGiOhFactory::getMaisDeck();
YuGiOhFactory::getOpponentsDeck();
YuGiOhFactory::getDefaultField();

All return Deck or Field objects as appropriate

c16r/yugioh-pegasus-castle-sprint 适用场景与选型建议

c16r/yugioh-pegasus-castle-sprint 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 43 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 08 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 c16r/yugioh-pegasus-castle-sprint 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 c16r/yugioh-pegasus-castle-sprint 我们能提供哪些服务?
定制开发 / 二次开发

基于 c16r/yugioh-pegasus-castle-sprint 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 43
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-18